Esempio n. 1
0
        public void Update()
        {
            _pauseMachine.Update();
            _partyTime.Update();

            if (_world == null)
            {
                return;
            }

            if (_panAnimation != null)
            {
                if (_panAnimation.Finished)
                {
                    DungeonManager.JumpToRoom(_panDestination.Y, _panDestination.X, _panAnimation.Direction);
                    Play();
                    _panAnimation = null;
                }
                else
                {
                    _panAnimation.Update();
                }
            }

            foreach (var updatable in _world.Updatables)
            {
                updatable.Update();
            }

            _lightInTheDarkness.Track(Player.Location.ToVector2() + new Vector2(8.0f, YOffset + 8.0f), Player.Direction);

            if (!Player.Alive)
            {
                GameOver();
            }
            if (Player.Won)
            {
                GameWin();
            }
            if (_pauseMachine.State != PauseState.Unpaused)
            {
                return;
            }

            _pauseMachine.Play();
            Play();
        }
Esempio n. 2
0
        public void DungeonPan(Point sourceRoom, Point destinationRoom, Direction direction)
        {
            if (DarkMode)
            {
                DungeonManager.JumpToRoom(destinationRoom.Y, destinationRoom.X, direction);
                return;
            }

            if (_worldState == WorldState.DungeonPanning)
            {
                return;
            }
            _panAnimation     = new PanAnimation(direction);
            _sourceScene      = _dungeonManager.BuildPanScene(sourceRoom.Y, sourceRoom.X);
            _destinationScene = _dungeonManager.BuildPanScene(destinationRoom.Y, destinationRoom.X);
            _panDestination   = destinationRoom;
            _world            = new PanningWorld(this);
            _worldState       = WorldState.DungeonPanning;
        }