Ejemplo n.º 1
0
 public void StopClimb()
 {
     if (OnLadder())
     {
         if (currentTrigger == null)
         {
             state = ELadderClimbState.NoLadder;
         }
         else
         {
             state = ELadderClimbState.CanClimb;
         }
     }
 }
Ejemplo n.º 2
0
    void OnTriggerExit(Collider other)
    {
        LadderTrigger trigger = other.GetComponent <LadderTrigger>();

        if (trigger == null)
        {
            return;
        }

        currentTrigger = null;
        if (state == ELadderClimbState.CanClimb)
        {
            state = ELadderClimbState.NoLadder;
        }
    }
Ejemplo n.º 3
0
    public void StartClimb()
    {
        Debug.Log("start climb");
        if (currentTrigger != null)
        {
            Debug.Assert(state == ELadderClimbState.CanClimb);
            if (currentTrigger.isTop)
            {
                state = ELadderClimbState.OnLadderTop;
            }
            else
            {
                state = ELadderClimbState.OnLadderBottom;
            }

            transform.position = currentTrigger.transform.position;
        }
    }