Hi,
I’m a beginner, i want to know if there are better way to handle this kind of situations, if in the future the game will be bigger, this kind of workflow can cause some performance issues? Thanks in advance.
if (scriptMovement.IsGrounded() && scriptMovement.horizontal == 0 && !scriptMovement.isShooting)
{
ChangeAnimationState(Player_Idle);
}
else if (scriptMovement.IsGrounded() && scriptMovement.horizontal < 0 || scriptMovement.IsGrounded() && scriptMovement.horizontal > 0)
{
ChangeAnimationState(Player_Run);
}
else if (!scriptMovement.IsGrounded() && rb.velocity.y < 0 && !scriptMovement.isWallSliding)
{
ChangeAnimationState(Player_FallOff);
}
else if (scriptMovement.isJumping)
{
ChangeAnimationState(Player_Jump);
}
else if (scriptMovement.isWallSliding && scriptMovement.WallSlide)
{
ChangeAnimationState(Player_WallSliding);
}
else if (scriptMovement.isShooting == true)
{
ChangeAnimationState(Player_Shooting);
Debug.Log(1);
}