Esempio n. 1
0
    IEnumerator StartJump()
    {
        state = SpineLearningBodyState.Jumping;
        yield return(new WaitForSeconds(1.25f));

        state = SpineLearningBodyState.Idle;
    }
Esempio n. 2
0
 public void TryMove(float speed)
 {
     currentSpeed = speed;
     if (speed != 0f)
     {
         facingLeft = (currentSpeed < 0f);
     }
     if (state != SpineLearningBodyState.Jumping)
     {
         state = (speed == 0) ? SpineLearningBodyState.Idle : SpineLearningBodyState.Running;
     }
 }
    // Update is called once per frame
    void Update()
    {
        if (skeletonAnimation == null)
        {
            return;
        }
        if (model == null)
        {
            return;
        }

        if (previousViewState != SpineLearningBodyState.Jumping)
        {
            Turn(model.facingLeft);
        }

        var currentModelState = model.state;

        if (previousViewState != currentModelState)
        {
            PlayNewStableAnimation();
        }
        previousViewState = currentModelState;
    }