2022-11-20 16:27:39 +08:00
|
|
|
|
using SHADE;
|
|
|
|
|
using System;
|
|
|
|
|
|
|
|
|
|
public class PlayerWalkState : BaseState
|
|
|
|
|
{
|
2022-11-21 21:01:44 +08:00
|
|
|
|
private float timer;
|
|
|
|
|
private float delay = 0.5f;
|
2023-03-10 00:16:38 +08:00
|
|
|
|
|
|
|
|
|
private AnimationClipAsset walkClip;
|
|
|
|
|
private Animator animator;
|
|
|
|
|
public PlayerWalkState(StateMachine stateMachine, Animator ani, AnimationClipAsset clip) : base(stateMachine)
|
2022-11-20 16:27:39 +08:00
|
|
|
|
{
|
|
|
|
|
stateName = "Walk State";
|
2023-03-10 00:16:38 +08:00
|
|
|
|
animator = ani;
|
|
|
|
|
walkClip = clip;
|
2022-11-20 16:27:39 +08:00
|
|
|
|
}
|
|
|
|
|
public override void OnEnter()
|
|
|
|
|
{
|
|
|
|
|
//Debug.Log("WALK ENTER");
|
2022-11-21 21:01:44 +08:00
|
|
|
|
timer = delay;
|
2023-03-10 00:16:38 +08:00
|
|
|
|
animator.Play(walkClip);
|
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)
|
|
|
|
|
{
|
2022-11-23 00:44:27 +08:00
|
|
|
|
Audio.PlaySFXOnce2D("event:/Raccoon/raccoon_footsteps");
|
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");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|