2022-11-20 16:27:39 +08:00
|
|
|
|
using SHADE;
|
2023-03-10 17:21:49 +08:00
|
|
|
|
using SHADE_Scripting.Audio;
|
2022-11-20 16:27:39 +08:00
|
|
|
|
using System;
|
|
|
|
|
|
|
|
|
|
public class PlayerRunState : BaseState
|
|
|
|
|
{
|
2022-11-21 21:01:44 +08:00
|
|
|
|
private float timer;
|
|
|
|
|
private float delay = 0.25f;
|
|
|
|
|
|
2023-03-10 16:26:52 +08:00
|
|
|
|
public PlayerRunState(StateMachine stateMachine) : base(stateMachine)
|
2022-11-20 16:27:39 +08:00
|
|
|
|
{
|
2022-11-21 21:01:44 +08:00
|
|
|
|
stateName = "Run State";
|
2022-11-20 16:27:39 +08:00
|
|
|
|
}
|
|
|
|
|
public override void OnEnter()
|
|
|
|
|
{
|
|
|
|
|
//Debug.Log("WALK ENTER");
|
2023-03-10 16:26:52 +08:00
|
|
|
|
if (PlayerAnimations.Instance)
|
|
|
|
|
{
|
|
|
|
|
PlayerAnimations.Instance.playerAnimator.Play(PlayerAnimations.Instance.playerRunClip);
|
|
|
|
|
PlayerAnimations.Instance.BagAnimator.Play(PlayerAnimations.Instance.playerRunClip);
|
|
|
|
|
}
|
2022-11-20 16:27:39 +08:00
|
|
|
|
}
|
|
|
|
|
public override void update()
|
|
|
|
|
{
|
|
|
|
|
//Debug.Log("WALKING");
|
2022-11-21 21:01:44 +08:00
|
|
|
|
timer += Time.DeltaTimeF;
|
|
|
|
|
|
|
|
|
|
if (timer > delay)
|
|
|
|
|
{
|
2023-03-10 17:21:49 +08:00
|
|
|
|
AudioHandler.audioClipHandlers["footsteps"].Play();
|
2022-11-21 21:01:44 +08:00
|
|
|
|
timer = 0;
|
|
|
|
|
}
|
2022-11-20 16:27:39 +08:00
|
|
|
|
}
|
|
|
|
|
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");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|