2using UnityEngine.Events;
11 [Header(
"Cell Child:")]
13 protected bool _autoAssignCell =
true;
18 public bool AutoAssignCell {
get => _autoAssignCell;
set => _autoAssignCell = value; }
26 protected Vector2Int _cellIndex;
30 public Vector2Int
CellIndex {
get => _cellIndex;
set => _cellIndex = Vector2Int.Max(value, Vector2Int.zero); }
39 [SerializeField]
private UnityEvent _onInitialize =
new UnityEvent();
43 public UnityEvent
OnInitialize {
get => _onInitialize;
set => _onInitialize = value; }
55 protected virtual void Awake()
60 protected virtual void OnDestroy()
An object tied to the cell index of a RoomComponent.
bool AutoAssignCell
If true, the cell will be automatically assigned to the closest cell when update and save operations ...
UnityEvent OnInitialize
The event invoked after the object is initialized.
RoomComponent Room
The containing room.
int Column
The column index.
virtual void Initialize()
Initializes the object.
virtual void AutoAssign(RoomComponent room)
Performs auto assignment on the object.
bool IsInitialized
True if the object has been initialized.
Vector2Int CellIndex
The containing cell index.
A component for creating a room.
UnityEvent OnInitialize
An event invoked when the room is initialized.
Vector2Int FindClosestActiveCellIndex(Vector3 position)
Returns the closest active cell index for the specified global position.