Example #1
0
 /// <summary>
 /// Should be called anytime the Pac Man needs to be reset (game start, level start)
 /// </summary>
 void Reset() {
     state_ = State.Start;
     direction_ = Direction.Right;
     usedFramesIndex_ = new int[] { 0, 1, 2 };
     position_ = new Position { Tile = new Point(13, 23), DeltaPixel = new Point(8, 0) };
     updateCount_ = 0;
 }
Example #2
0
 /// <summary>
 /// Retrieves the next tile in the specified direction from the specified position.
 /// </summary>
 /// <param name="d">Direction in which to look</param>
 /// <param name="p">Position from which to look</param>
 /// <returns>The tile</returns>
 public static Tile NextTile(Direction d, Position p) {
     switch (d) {
         case Direction.Up:
             if (p.Tile.Y - 1 < 0) {
                 return Grid.TileGrid[p.Tile.X, p.Tile.Y];
             } else {
                 return Grid.TileGrid[p.Tile.X, p.Tile.Y - 1];
             }
         case Direction.Down:
             if (p.Tile.Y + 1 >= Grid.Height) {
                 return Grid.TileGrid[p.Tile.X, p.Tile.Y];
             } else {
                 return Grid.TileGrid[p.Tile.X, p.Tile.Y + 1];
             }
         case Direction.Left:
             // Special case : the tunnel
             if (p.Tile.X == 0) {
                 return Grid.TileGrid[Grid.Width - 1, p.Tile.Y];
             } else {
                 return Grid.TileGrid[p.Tile.X - 1, p.Tile.Y];
             }
         case Direction.Right:
             // Special case : the tunnel
             if (p.Tile.X + 1 >= Grid.Width) {
                 return Grid.TileGrid[0, p.Tile.Y];
             } else {
                 return Grid.TileGrid[p.Tile.X + 1, p.Tile.Y];
             }
         default:
             throw new ArgumentException();
     }
 }
Example #3
0
 public ScoreEvent(Position position, DateTime when, int score) {
     Position = position;
     When = when;
     Score = score;
 }