// Update is called once per frame
    void Update()
    {
        if (darkPlayerScript.GetYSpeed() > 0.2f && !darkPlayerScript.GetIsGrounded())//if the player is moving up and is not grounded
        {
            JumpAnimation();
            wasAirborne = true;
        }
        else if (darkPlayerScript.GetYSpeed() < 0 && !darkPlayerScript.GetIsGrounded())
        {
            FallAnimation();
            wasAirborne = true;
        }
        else if (darkPlayerScript.GetIsGrounded() && wasAirborne)
        {
            LandAnimation();
            wasAirborne = false;
        }
        else if (Mathf.Abs(darkPlayerScript.GetXSpeed()) > 0.5f) //if moving
        {
            RunAnimation();
            wasAirborne = false;
        }
        else
        {
            IdleAnimation();
            wasAirborne = false;
        }

        ChangeDirectionCheck();
    }
Esempio n. 2
0
 // Update is called once per frame
 void Update()
 {
     if (darkScript.GetIsGrounded() && Mathf.Abs(darkScript.GetXSpeed()) > 0.2f)//is walking
     {
         runPartSys.Play();
         jumpPartSys.Stop();
     }
     else if (darkScript.GetIsGrounded() && Input.GetKeyDown(KeyCode.Space) && darkScript.getIsControlsActive())//jumping
     {
         runPartSys.Stop();
         jumpPartSys.Play();
     }
     else
     {
         runPartSys.Stop();
         jumpPartSys.Stop();
     }
 }