public void ProcessGraphics()
        {
            ClearFrame();
            PlayerEntity player = MasterEntityManager.GetPlayer() as PlayerEntity;

            if (player != null)
            {
                RenderMap(ref player);
                RenderHud(ref player);
            }
        }
Beispiel #2
0
        public void ProcessGame()
        {
            InputCommand command = MasterInputManager.PopCommand();
            PlayerEntity player  = MasterEntityManager.GetPlayer() as PlayerEntity;

            if (player == null)
            {
                Console.WriteLine("Player is NULL");
                Environment.Exit(0);
            }

            if (command == InputCommand.Unknown)
            {
                //If there are no commands to process don't do anything
                return;
            }

            if (command == InputCommand.RestartGame)
            {
                Console.WriteLine("Lets go!");
                ResetGame(ref player);
            }

            if (command == InputCommand.ExitGame)
            {
                Console.WriteLine("Thank you for playing");
                Environment.Exit(0);
            }

            if (!player.isAlive())
            {
                MasterGameState = GameState.Ended;
                return;
            }

            Point currentPosition = player.Position;

            MoveEntities(ref player, command);
            UpdateTiles(currentPosition, player.Position);
            UpdateDamage(ref player);
        }
Beispiel #3
0
        public void ProcessGame()
        {
            InputCommand command = MasterInputManager.PopCommand();
            PlayerEntity player  = MasterEntityManager.GetPlayer() as PlayerEntity;

            if (player == null)
            {
                Console.WriteLine("Player is NULL");
                Environment.Exit(0);
            }

            if (command == InputCommand.Unknown)
            {
                //If there are no commands to process don't do anything
                return;
            }

            if (command == InputCommand.RestartGameSameMap)
            {
                if (MasterWorldManager.GetCurrentMap() == null)
                {
                    MasterWorldManager.Initialize();
                }
                else
                {
                    ResetGame(ref player);
                }

                MasterGameState = GameState.Running;
            }

            if (command == InputCommand.RestartGameDifferentMap)
            {
                MasterWorldManager.Initialize();
                player.Reset();
                MasterGameState = GameState.Running;
            }

            if (command == InputCommand.ExitGame)
            {
                MasterGameState = GameState.Ended;
                Console.Clear();
                Console.WriteLine("Thank you for playing!");
                Thread.Sleep(2000);
                Environment.Exit(0);
            }

            if (!player.isAlive())
            {
                MasterGameState = GameState.Ended;
                return;
            }

            if (MasterGameState == GameState.Running)
            {
                Point currentPosition = player.Position;
                MoveEntities(player, command);
                UpdateTiles(currentPosition, player.Position);
                UpdateDamage(player);
                if (ReadyForPlayerTransition(currentPosition))
                {
                    TransitionMap(player);
                }
            }
        }