Ejemplo n.º 1
0
 /// <summary>
 /// Moves the playerMovement to certain direction
 /// </summary>
 /// <param name="direction"> Direction pointing where the playerMovement is going to move, it is suggested to use Vector2.left or Vector2.right</param>
 public void MovePlayerHorizontally(Vector2 direction)
 {
     if (isFalling || isAscending || GameManager.Instance.State != GameStates.Play || player.State != PlayerState.Running)
     {
         return;
     }
     // Pop up an error if vertical movement is attempted
     if (direction.y != 0)
     {
         Debug.LogError("No  verical movement is allowed in this method");
         return;
     }
     // Move the playerMovement in a given horizintal direction multiplied by the movement speed and the delta time
     rgbdy.MovePosition(rgbdy.position + direction * movementSpeed * Time.deltaTime);
     if (!LimitsManager.CharacterInsideLine(rgbdy.position))
     {
         MoveToOtherSide();
     }
 }
Ejemplo n.º 2
0
 protected override bool CheckBoundaries()
 {
     return(!LimitsManager.CharacterInsideLine(hazardTransform.position));
 }
Ejemplo n.º 3
0
 protected override bool CheckBoundaries()
 {
     return(!LimitsManager.HoleInsideLine(Camera.main, hazardTransform.position));
 }