예제 #1
0
파일: Enemy.cs 프로젝트: NuggetBox/MacPan
        // Moves the enemy to the next step in its given path.
        void Walk()
        {
            if (path.Count != 0)
            {
                step = path[0];
                path.RemoveAt(0);
            }

            // If the enemy attempts to walk into the player, the player has been busted and has to respawn.
            if (step.Equals(Player.Singleton.Position))
            {
                // PLAYER BUSTED.
                Player.Singleton.ReturnTrophies();
                Player.HealthPoints--;
                ReadMap.UpdateHealthBar();
                Statistics.Stats["Busted"].Add(1);

                if (Player.HealthPoints == 0)
                {
                    Player.CollectedTrophies = 0;
                    Menu.GameRunning         = false;
                }

                Player.Singleton.AttemptRespawn();
            }
            else
            {
                if (Game.GameObjects[step.X, step.Y] == null)
                {
                    Position = step;
                }
            }
        }
예제 #2
0
        // Initializes the game, reads and draws the map.
        public Game()
        {
            BoxSize     = new Point(2, 1);
            GridSize    = new Point(120, 46);
            GameObjects = new GameObject[GridSize.X, GridSize.Y];

            Console.SetWindowSize(Console.LargestWindowWidth, Console.LargestWindowHeight);
            Console.SetBufferSize(Console.LargestWindowWidth, Console.LargestWindowHeight);
            Maximize();
            Console.CursorVisible = false;

            ReadMap.InitializeMap();

            InitializeBoard();

            Console.SetCursorPosition(0, 0);
        }