Beispiel #1
0
        public bool ChangeRoom(R room)
        {
            if (_transitionHandler != null && _transitionHandler.IsInProcess)
            {
                return(false);
            }

            if (CurrentRoom != null)
            {
                if (OnBeforeRoomClosed != null)
                {
                    OnBeforeRoomClosed.Invoke(CurrentRoom);
                }
            }

            _followingRoom = room;

            if (_transitionHandler == null)
            {
                if (OnAfterRoomOpened != null)
                {
                    OnAfterRoomOpened.Invoke(CurrentRoom);
                }
            }
            else
            {
                _transitionHandler.InvokeTransitionAction(CurrentRoom, room, RoomAfterTransitionAction);
            }

            return(true);
        }
Beispiel #2
0
        private void RoomAfterTransitionAction()
        {
            CurrentRoom = _followingRoom;

            if (OnAfterRoomOpened != null)
            {
                OnAfterRoomOpened.Invoke(CurrentRoom);
            }
        }