using SHADE; using SHADE_Scripting.Audio; using System; public class PlayerWalkState : BaseState { private float timer; private float delay = 0.5f; private bool holdItem; public PlayerWalkState(StateMachine stateMachine, bool hi) : base(stateMachine) { stateName = "Walk State"; holdItem = hi; } public override void OnEnter() { //Debug.Log("WALK ENTER"); timer = delay; if (PlayerAnimations.Instance) { if (!holdItem) { if (PlayerAnimations.Instance.playerWalkClip) { PlayerAnimations.Instance.playerAnimator.Play(PlayerAnimations.Instance.playerWalkClip); PlayerAnimations.Instance.BagAnimator.Play(PlayerAnimations.Instance.playerWalkClip); PlayerAnimations.Instance.silhoPlayerAnimator.Play(PlayerAnimations.Instance.playerWalkClip); PlayerAnimations.Instance.silhoBagAnimator.Play(PlayerAnimations.Instance.playerWalkClip); } } else { if (PlayerAnimations.Instance.playerCarryWalkClip) { PlayerAnimations.Instance.playerAnimator.Play(PlayerAnimations.Instance.playerCarryWalkClip); PlayerAnimations.Instance.BagAnimator.Play(PlayerAnimations.Instance.playerCarryWalkClip); PlayerAnimations.Instance.silhoPlayerAnimator.Play(PlayerAnimations.Instance.playerCarryWalkClip); PlayerAnimations.Instance.silhoBagAnimator.Play(PlayerAnimations.Instance.playerCarryWalkClip); } } } } 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"); } }