SHADE_Y3/Assets/Scripts/Gameplay/Player/PlayerStates/UT_PlayerJumpState.cs

86 lines
3.0 KiB
C#

using SHADE;
using System;
public class PlayerJumpState : BaseState
{
public PlayerJumpState(StateMachine stateMachine) : base(stateMachine)
{
stateName = "Jump State";
}
public override void OnEnter()
{
//Debug.Log("jump");
if (PlayerAnimations.Instance)
{
if (!machine.GetScript<PlayerController>().holdItem && PlayerAnimations.Instance.playerJumpStartClip)
{
PlayerAnimations.Instance.playerAnimator.PlayOneShot(PlayerAnimations.Instance.playerJumpStartClip);
PlayerAnimations.Instance.BagAnimator.PlayOneShot(PlayerAnimations.Instance.playerJumpStartClip);
PlayerAnimations.Instance.silhoPlayerAnimator.PlayOneShot(PlayerAnimations.Instance.playerJumpStartClip);
PlayerAnimations.Instance.silhoBagAnimator.PlayOneShot(PlayerAnimations.Instance.playerJumpStartClip);
PlayerAnimations.Instance.playerAnimator.OnClipFinished.RegisterAction((x) =>
{
if (x.FinishedClip == PlayerAnimations.Instance.playerJumpStartClip)
{
PlayerAnimations.Instance.playerAnimator.Play(PlayerAnimations.Instance.playerJumpLoopClip);
}
});
PlayerAnimations.Instance.BagAnimator.OnClipFinished.RegisterAction((x) =>
{
if (x.FinishedClip == PlayerAnimations.Instance.playerJumpStartClip)
{
PlayerAnimations.Instance.BagAnimator.Play(PlayerAnimations.Instance.playerJumpLoopClip);
}
});
PlayerAnimations.Instance.silhoPlayerAnimator.OnClipFinished.RegisterAction((x) =>
{
if (x.FinishedClip == PlayerAnimations.Instance.playerJumpStartClip)
{
PlayerAnimations.Instance.silhoPlayerAnimator.Play(PlayerAnimations.Instance.playerJumpLoopClip);
}
});
PlayerAnimations.Instance.silhoBagAnimator.OnClipFinished.RegisterAction((x) =>
{
if (x.FinishedClip == PlayerAnimations.Instance.playerJumpStartClip)
{
PlayerAnimations.Instance.silhoBagAnimator.Play(PlayerAnimations.Instance.playerJumpLoopClip);
}
});
}
else if (machine.GetScript<PlayerController>().holdItem && PlayerAnimations.Instance.playerJumpLoopClip)
{
PlayerAnimations.Instance.playerAnimator.Play(PlayerAnimations.Instance.playerJumpLoopClip);
PlayerAnimations.Instance.BagAnimator.Play(PlayerAnimations.Instance.playerJumpLoopClip);
PlayerAnimations.Instance.silhoPlayerAnimator.Play(PlayerAnimations.Instance.playerJumpLoopClip);
PlayerAnimations.Instance.silhoBagAnimator.Play(PlayerAnimations.Instance.playerJumpLoopClip);
}
else
{
Debug.LogError("missing playercontroller in jump state");
}
}
}
public override void update()
{
//Debug.Log("WALKING");
}
public override void fixedUpdate()
{
//Debug.Log("FIXED WALKING");
}
public override void OnExit()
{
//Debug.Log("WALK EXIT");
}
public override void onTriggerEnter(CollisionInfo info)
{
//Debug.Log("TRIGGER");
}
}