示例#1
0
 public bool SatisfiesMovementConstraints(Vector2 targetDestination)
 {
     if (targetDestination == Vector2.up || targetDestination == Vector2.down)
     {
         float targetDestinationYPosition = transform.position.y + (targetDestination.y * m_characterMover.GetDistanceForEachStep());
         if (Mathf.Abs(targetDestinationYPosition - m_originalPosition.y) <= m_characterMover.GetDistanceForEachStep() * m_maxVerticalTilesToMove)
         {
             return(true);
         }
     }
     if (targetDestination == Vector2.right || targetDestination == Vector2.left)
     {
         float targetDestinationXPosition = transform.position.x + (targetDestination.x * m_characterMover.GetDistanceForEachStep());
         if (Mathf.Abs(targetDestinationXPosition - m_originalPosition.x) <= m_characterMover.GetDistanceForEachStep() * m_maxHorizontalTilesToMove)
         {
             return(true);
         }
     }
     return(false);
 }