コード例 #1
0
ファイル: Program.cs プロジェクト: lancelotx999/pacman
        public static void Main(string[] args)
        {
            Console.Clear ();
            Console.WriteLine ("Enter User Name: ");
            string UserName;
            UserName = Console.ReadLine();
            Game MainGame = new Game (UserName);
            MainGame.Board.ReadMap ();

            MainGame.Board.DrawBoard ();
            MainGame.DisplayInstructionScore ();

            do
            {
                MainGame.Pacman.MovementFunction ();
                MainGame.RandomGhost.MovementFunction();
                MainGame.TrackingGhost.TrackMovementFunction();
                MainGame.Board.DrawBoard ();
                MainGame.DisplayInstructionScore ();
            }while(MainGame.GameOverState == false);

            Console.WriteLine ("Game Over");
        }
コード例 #2
0
ファイル: TestCases.cs プロジェクト: lancelotx999/pacman
        public void TestPlayer()
        {
            string UserName;
            UserName = "******";
            Game TestGame = new Game (UserName);
            TestGame.Board.ReadMap ();

            TestGame.Board.DrawBoard ();
            TestGame.DisplayInstructionScore ();

            TestGame.RandomGhost.Position.X = 1;
            TestGame.RandomGhost.Position.Y = 1;

            Assert.IsTrue (TestGame.Player.Lives == 3);

            TestGame.Pacman.CheckFunction ();
            TestGame.RandomGhost.CheckFunction ();
            Assert.IsTrue (TestGame.Player.Lives == 2);
        }
コード例 #3
0
ファイル: TestCases.cs プロジェクト: lancelotx999/pacman
        public void TestPacman()
        {
            string UserName;
            UserName = "******";
            Game TestGame = new Game (UserName);
            TestGame.Board.ReadMap ();

            TestGame.Board.DrawBoard ();
            TestGame.DisplayInstructionScore ();

            Assert.IsTrue (TestGame.Pacman.Position.X == 1);
            Assert.IsTrue (TestGame.Pacman.Position.Y == 1);
            Assert.IsTrue (TestGame.Pacman.State == 0);
            Assert.IsTrue (TestGame.Player.Score == 0);

            TestGame.Pacman.MovementFunction ('S');

            Assert.IsTrue (TestGame.Pacman.Position.X == 2);
            Assert.IsTrue (TestGame.Pacman.Position.Y == 1);
            Assert.IsTrue (TestGame.Player.Score == 3);
            Assert.IsTrue (TestGame.Pacman.State == 1);

            TestGame.Pacman.MovementFunction ('W');

            Assert.IsTrue (TestGame.Pacman.Position.X == 1);
            Assert.IsTrue (TestGame.Pacman.Position.Y == 1);

            TestGame.Pacman.MovementFunction ('D');

            Assert.IsTrue (TestGame.Pacman.Position.X == 1);
            Assert.IsTrue (TestGame.Pacman.Position.Y == 2);
            Assert.IsTrue (TestGame.Player.Score == 4);

            TestGame.Pacman.MovementFunction ('A');

            Assert.IsTrue (TestGame.Pacman.Position.X == 1);
            Assert.IsTrue (TestGame.Pacman.Position.Y == 1);
        }