ManiaMap.Unity
Procedural generation of metroidvania style maps for Unity.
CellArea.cs
1using UnityEngine;
2
4{
8 public abstract class CellArea : MonoBehaviour
9 {
13 public int Row { get; protected set; }
14
15 // <summary>
18 public int Column { get; protected set; }
19
23 public RoomComponent Room { get; protected set; }
24
34 public static CellArea InstantiateCellArea(int row, int column, RoomComponent room,
35 int cellLayer, LayerMask triggeringLayers)
36 {
37 switch (room.RoomType)
38 {
39 case RoomType.TwoDimensional:
40 return CellArea2D.InstantiateCellArea2D(row, column, room, cellLayer, triggeringLayers);
41 case RoomType.ThreeDimensionalXY:
42 case RoomType.ThreeDimensionalXZ:
43 return CellArea3D.InstantiateCellArea3D(row, column, room, cellLayer, triggeringLayers);
44 default:
45 throw new System.NotImplementedException($"Unhandled room type: {room.RoomType}.");
46 }
47 }
48
55 protected void Initialize(int row, int column, RoomComponent room)
56 {
57 Row = row;
58 Column = column;
59 Room = room;
60 }
61 }
62}
A 2D trigger to detect if an object on a monitored physics layer mask enters or exits a RoomComponent...
Definition: CellArea2D.cs:10
static CellArea2D InstantiateCellArea2D(int row, int column, RoomComponent room, int cellLayer, LayerMask triggeringLayers)
Instantiates a new cell area within the specified room.
Definition: CellArea2D.cs:29
A 3D trigger to detect if an object on a monitored physics layer mask enters or exits a RoomComponent...
Definition: CellArea3D.cs:10
static CellArea3D InstantiateCellArea3D(int row, int column, RoomComponent room, int cellLayer, LayerMask triggeringLayers)
Instantiates a new cell area within the specified room.
Definition: CellArea3D.cs:29
The base class for cell trigger areas.
Definition: CellArea.cs:9
int Row
The row index corresponding to the area.
Definition: CellArea.cs:13
RoomComponent Room
The containing room.
Definition: CellArea.cs:23
static CellArea InstantiateCellArea(int row, int column, RoomComponent room, int cellLayer, LayerMask triggeringLayers)
Instantiates a new cell area within the specified room.
Definition: CellArea.cs:34
void Initialize(int row, int column, RoomComponent room)
Initializes the base properties for the area.
Definition: CellArea.cs:55
A component for creating a room.
RoomType RoomType
The room type.
RoomType
The type of room.
Definition: RoomType.cs:9