コード例 #1
0
        public void ShouldChangeDirection_WhenDirectionIsGiven()
        {
            var monster = new Pacman.Monster(12, 15);

            monster.Move(Direction.South, 12, 15);
            Assert.Equal(Direction.South, monster.FacingDirection);
        }
コード例 #2
0
        public void ShouldUpdateLocation_WhenRowAndColumnAreGiven()
        {
            var monster = new Pacman.Monster(12, 15);

            monster.Move(Direction.North, 10, 20);
            Assert.Equal(new int[] { 10, 20 }, monster.Location);
        }
コード例 #3
0
        public void ShouldPrintMapWithMonster_WhenSquareHasMonster()
        {
            var monster    = new Pacman.Monster(1, 1);
            var pacman     = new Pacman.Pacman(Direction.North, 0, 0);
            var characters = new List <ICharacter> {
                monster, pacman
            };

            presenter.PrintMap(map, characters);
            mockio.Verify(x => x.Output("V🍬🍬\n🍬👻🍬\n🍬🍬🍬"), Times.Exactly(1));
        }
コード例 #4
0
        public Main()
        {
            InitializeComponent();
            paper    = pctPlayField.CreateGraphics();
            muren    = new Muren();
            rndAngle = new Random();
            splash   = new Splash();
            #region initialize pacman & ghosts
            //pacman
            pacman         = new Pacman();
            pacman.X       = 10;
            pacman.Y       = 12;
            pacman.Angle   = 0;
            pacman.Wall    = 0;
            pacman.PrevX   = 10;
            pacman.PrevY   = 12;
            pacman.Sprites = pacman.pacmanUp;

            //red ghost
            redGhost           = new Monster();
            redGhost.X         = 10;
            redGhost.Y         = 10;
            redGhost.Angle     = 3;
            redGhost.Wall      = 0;
            redGhost.PrevX     = 10;
            redGhost.PrevY     = 10;
            redGhost.PrevAngle = 0;
            redGhost.Sprites   = Image.FromFile("../../images/ghostRed.png");

            //green ghost
            greenGhost           = new Monster();
            greenGhost.X         = 11;
            greenGhost.Y         = 10;
            greenGhost.Angle     = 3;
            greenGhost.Wall      = 0;
            greenGhost.PrevX     = 11;
            greenGhost.PrevY     = 10;
            greenGhost.PrevAngle = 0;
            greenGhost.Sprites   = Image.FromFile("../../images/ghostGreen.png");

            //yellow ghost
            yellowGhost           = new Monster();
            yellowGhost.X         = 9;
            yellowGhost.Y         = 10;
            yellowGhost.Angle     = 3;
            yellowGhost.Wall      = 0;
            yellowGhost.PrevX     = 9;
            yellowGhost.PrevY     = 10;
            yellowGhost.PrevAngle = 0;
            yellowGhost.Sprites   = Image.FromFile("../../images/ghostYellow.png");

            //pink ghost
            pinkGhost           = new Monster();
            pinkGhost.X         = 8;
            pinkGhost.Y         = 10;
            pinkGhost.Angle     = 3;
            pinkGhost.Wall      = 0;
            pinkGhost.PrevX     = 8;
            pinkGhost.PrevY     = 10;
            pinkGhost.PrevAngle = 0;
            pinkGhost.Sprites   = Image.FromFile("../../images/ghostPink.png");
            #endregion
        }