PlayerAnimation.Play C# (CSharp) Method

Play() public method

public Play ( int id ) : void
id int
return void
    public void Play(int id)
    {
        string mode = PLAYER_ANIMATIONS[id];
        if (mode != "")
            animComp.Play(mode);
        /*string mode = "";
        switch (id) {
        case 0:
            mode = "Idle";
            break;
        case 1:
            mode = "Walk";
            break;
        case 2:
            mode = "Standing";
            break;
            case 3:
            mode = "StandingFire";
            break;
            case 4:
            mode = "StandingAim";
            break;
            case 5:
            mode = "WalkFire";
            break;
            case 6:
            mode = "WalkAim";
            break;
        }*/
    }

Usage Example

    void FixedUpdate()
    {
        if (isJumping)
        {
            FixedUpdateJump();

            if (!isSurfing)
            {
                if (Random.Range(0, 20) < 15)
                {
                    m_Animations.Play(PlayerAnimation.PlayerStates.Jump);
                }
                else
                {
                    m_Animations.Play(PlayerAnimation.PlayerStates.Jump2);
                }
            }
            else
            {
                m_Animations.Play(PlayerAnimation.PlayerStates.Jump);
            }
            //Debug.Log("Jumping");
            isJumping = false;
        }
        if (isFallingDown)
        {
            ChangeGravity();
            DownForce();

            isFallingDown = false;
        }
    }
All Usage Examples Of PlayerAnimation::Play