I've been lurking this forum for a little while and I love it. I just love how quickly the staff answers questions. I'm using State Machine logic, so I'll include the parts that change to Jumping and part that changes to Idle.
public void SetAnimation(string animationName, bool loop)
{
skeletonAnimation.AnimationState.SetAnimation(0, animationName, loop);
}
When the jump button is pressed it calles the above:
player.SetAnimation("Jump", false);
Then there's a check to see if the player is grounded before switching to Idle:
if (player.IsNearWall() && player.JumpBuffered)
{
ChangeState(new WallJumpState(player, stateMachine));
}
else if (player.IsGrounded() && Time.time - jumpStartTime > player.MinJumpDuration)
{
if (player.MoveInput != 0)
{
ChangeState(new WalkState(player, stateMachine));
}
else
{
Debug.Log("Player is Grounded - Switching to Idle");
ChangeState(new IdleState(player, stateMachine));
}
}
The ChangeState will then call:
player.SetAnimation("Idle", true);
I do have questions regarding your explanation, is the mix something that can be set with the SkeletonAnimation or that's more when using the Animator in Unity?