예제 #1
0
 /// <summary>
 /// Should be called anytime the Pac Man needs to be reset (game start, level start)
 /// </summary>
 void Reset()
 {
     State            = EGamePlayState.Start;
     Direction        = EDirection.Right;
     mUsedFramesIndex = new int[] { 0, 1, 2 };
     Position         = new EntityPosition {
         Tile = new Point(13, 23), DeltaPixel = new Point(8, 0)
     };
     mUpdateCount = 0;
 }
예제 #2
0
 /// <summary>
 /// Put the ghosts back in their home, ready to begin a new attack
 /// </summary>
 /// <param name="newLevel">True at level start, false otherwise</param>
 /// <param name="player">The pac man. Pac Man is often respawned with the ghosts, so they need to know about the new Pac Man.</param>
 public void Reset(bool newLevel, Player player)
 {
     State          = EGhostState.Home;    // Ghosts start at home
     previousState_ = EGhostState.Home;    // Sounds are played when currentState != previousState.
     // So to get them playing at level start, we do this simple hack.
     updateCount_       = 0;
     initialJumps_      = Constants.InitialJumps(GhostType, newLevel);
     position_          = Constants.startPosition(GhostType);
     scheduleStateEval_ = true;
     lastJunction_      = new Point();
     player_            = player;
     scatterModesLeft_  = 4;
     UpdateSpeed();
 }
예제 #3
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 GridTile NextTile(EDirection d, EntityPosition p)
        {
            switch (d)
            {
            case EDirection.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 EDirection.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 EDirection.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 EDirection.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();
            }
        }
예제 #4
0
		public ScoreEvent(EntityPosition position, DateTime date, int score) {
			Position = position;
			Date = date;
			Score = score;
		}
예제 #5
0
 public ScoreEvent(EntityPosition position, DateTime date, int score)
 {
     Position = position;
     Date     = date;
     Score    = score;
 }
예제 #6
0
파일: Player.cs 프로젝트: GodLesZ/svn-dump
		/// <summary>
		/// Should be called anytime the Pac Man needs to be reset (game start, level start)
		/// </summary>
		void Reset() {
			State = EGamePlayState.Start;
			Direction = EDirection.Right;
			mUsedFramesIndex = new int[] { 0, 1, 2 };
			Position = new EntityPosition { Tile = new Point(13, 23), DeltaPixel = new Point(8, 0) };
			mUpdateCount = 0;
		}