Example #1
0
        public void Awake()
        {
            Instance = this;

            if (!Level.Instance.TryGetPersistence(this, out _persistence))
            {
                _persistence = new RoomPersistence(Tag);// (_persistenceTemplate);
                Level.Instance.Add(_persistence);
                _isRegistering = true;
            }
            else
            {
                DestroyImmediate(_objectsParent.gameObject);
                _persistence.LoadContent(this);
                _isRegistering = false;
            }

            OnRoomAwakeStaticHandler?.Invoke(this);
        }
Example #2
0
 public void Add(RoomPersistence room)
 {
     _rooms.Add(room.Id, room);
 }
Example #3
0
 public bool TryGetPersistence(Room room, out RoomPersistence persistence)
 {
     return(_rooms.TryGetValue(
                room.Tag.GetInstanceID(),
                out persistence));
 }