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

48 lines
1.0 KiB
C#

using SHADE;
using SHADE_Scripting.Audio;
using System;
public class PlayerRunState : BaseState
{
private float timer;
private float delay = 0.25f;
public PlayerRunState(StateMachine stateMachine) : base(stateMachine)
{
stateName = "Run State";
}
public override void OnEnter()
{
//Debug.Log("WALK ENTER");
if (PlayerAnimations.Instance)
{
PlayerAnimations.Instance.playerAnimator.Play(PlayerAnimations.Instance.playerRunClip);
PlayerAnimations.Instance.BagAnimator.Play(PlayerAnimations.Instance.playerRunClip);
}
}
public override void update()
{
//Debug.Log("WALKING");
timer += Time.DeltaTimeF;
if (timer > delay)
{
AudioHandler.audioClipHandlers["footsteps"].Play();
timer = 0;
}
}
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");
}
}