Beispiel #1
0
        public Location GetChaseTarget(PacMan pacMan, Location blinky)
        {
            var pacCell = pacMan.Location.Cell;

            blinky = blinky.Cell;
            switch (Colour)
            {
            case GhostColour.Red:
                return(pacCell);

            case GhostColour.Pink:
                return(pacCell
                       .Move(pacMan.Direction)
                       .Move(pacMan.Direction)
                       .Move(pacMan.Direction)
                       .Move(pacMan.Direction));

            case GhostColour.Cyan:
                var newCell = pacCell
                              .Move(pacMan.Direction)
                              .Move(pacMan.Direction);
                var dx = newCell.X - blinky.X;
                var dy = newCell.Y - blinky.Y;
                return(blinky.Add(2 * dx, 2 * dy));

            case GhostColour.Orange:
                return(Location.Cell.DistanceTo(pacCell) < 64
                        ? ScatterTarget
                        : pacCell);

            default:
                return(Location.Cell);
            }
        }
Beispiel #2
0
 private void ResetGhostsAndPacMan()
 {
     _blinky = _levelSetup.InitialBlinky;
     _pinky  = _levelSetup.InitialPinky;
     _inky   = _levelSetup.InitialInky;
     _clyde  = _levelSetup.InitialClyde;
     _pacMan = _levelSetup.InitialPacMan;
     _scatterChase.Reset(_level);
 }
Beispiel #3
0
 public void DrawPacMan(PacMan pacMan)
 {
     DrawBoardSprite(_spriteSet.PacMan(pacMan), pacMan.Location);
 }