示例#1
0
 /// <summary>
 /// Method that moves the ghost towards pacman
 /// </summary>
 public void Move()
 {
     //Changes Target positions once it passes the previous target
     if (target == position)
     {
         target = pacman.Position;
     }
     //Use the state objec to decide how to move
     currentState.Move();
 }
示例#2
0
        /// <summary>
        /// Moves ghost based on the IGhostState it is currently set to. When a move has been made, checks to see if a collision has been made
        /// </summary>
        public void Move()
        {
            if (Position.X == target.X && Position.Y == target.Y)
            {
                if (currentState is Chase)
                {
                    ((Chase)currentState).UpdateTarget(pacman.Position);
                }
                target = pacman.Position;
            }

            currentState.Move();
            Collide();
        }
示例#3
0
 /// <summary>
 /// A Ghost can move depending his state because we
 /// use an interface the Move will be choosed at run-time
 /// </summary>
 public void Move()
 {
     currentState.Move();
     this.Collide();
 }