-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathRoomDefinition.cs
119 lines (106 loc) · 2.37 KB
/
RoomDefinition.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
using ObstacleTowerGeneration.MissionGraph;
using UnityEngine;
/// <summary>
/// Defines contents and layout of a given room.
/// </summary>
public struct RoomDefinition
{
public int[,] moduleGrid;
public int[,] itemGrid;
public int size;
public VisualTheme visualTheme;
public NodeType roomType;
public RoomDefinition(int size, NodeType type)
{
this.size = size;
moduleGrid = new int[size, size];
itemGrid = new int[size, size];
visualTheme = VisualTheme.Ancient;
roomType = type;
}
public void SetModulePosition(int x, int z, ModuleTypes moduleType)
{
moduleGrid[x, z] = moduleType.GetHashCode();
}
public ModuleTypes GetModuleType(int x, int z)
{
return (ModuleTypes) moduleGrid[x, z];
}
public void SetItemPosition(int x, int z, ItemTypes itemType)
{
itemGrid[x, z] = itemType.GetHashCode();
}
public ItemTypes GetItemType(int x, int z)
{
return (ItemTypes) moduleGrid[x, z];
}
public void Print()
{
string printModuleList = "Module Layout:\n";
string printItemList = "Item Layout:\n";
for (int i = 0; i < size; i++)
{
for (int j = 0; j < size; j++)
{
printModuleList += moduleGrid[i, j];
printItemList += itemGrid[i, j];
}
printModuleList += '\n';
printItemList += '\n';
}
Debug.Log(printModuleList);
Debug.Log(printItemList);
}
}
public enum ModuleTypes
{
Pit,
Wall,
WallCorner,
PlatformLarge,
PlatformColumn,
PlatformStack2,
PlatformLargeColumnOscY,
PlatformStack1,
PlatformLargeOscY,
PlatformSmall,
DoorEntrance,
DoorExit,
DoorBetween,
DoorPuzzle,
DoorLocked,
PlatformTall,
PlatformMoving,
PlatformSmallOscY,
WallWindow,
PlatformStack3,
PlatformHazard4Arm,
PlatformHazard1Arm,
PlatformSmallHazardSpinning,
PlatformSmallOscYSpinning,
PlatformLargeColumn2OscY,
DoorLever,
DoorOneWay,
PlatformTarget
}
public enum ItemTypes
{
None,
Key,
Orb,
Block,
BlockTrigger,
RobotStatic,
RobotPatrol,
RobotPatrolEndWaypoint,
RobotChasing,
BlockReset
}
public enum VisualTheme
{
Ancient,
Moorish,
Industrial,
Modern,
Future
}