48 lines
972 B
C#
48 lines
972 B
C#
using SHADE;
|
|
using System;
|
|
|
|
public class PlayerWalkState : BaseState
|
|
{
|
|
private float timer;
|
|
private float delay = 0.5f;
|
|
|
|
private AnimationClipAsset walkClip;
|
|
private Animator animator;
|
|
public PlayerWalkState(StateMachine stateMachine, Animator ani, AnimationClipAsset clip) : base(stateMachine)
|
|
{
|
|
stateName = "Walk State";
|
|
animator = ani;
|
|
walkClip = clip;
|
|
}
|
|
public override void OnEnter()
|
|
{
|
|
//Debug.Log("WALK ENTER");
|
|
timer = delay;
|
|
animator.Play(walkClip);
|
|
}
|
|
public override void update()
|
|
{
|
|
//Debug.Log("WALKING");
|
|
timer += Time.DeltaTimeF;
|
|
|
|
if (timer > delay)
|
|
{
|
|
Audio.PlaySFXOnce2D("event:/Raccoon/raccoon_footsteps");
|
|
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");
|
|
}
|
|
}
|
|
|