// Use this for initialization void Start() { rend = GetComponent <SpriteRenderer>(); alphaColor = rend.color; colorValue = 1.0f; sfxClip.value.Enqueue(sfxList.RandomClip()); playSfx.Invoke(); }
public override void UpdateState(AnimationInformation info, float speed) { animator.speed = speed; if (info.walkDirection == Constants.Direction.LEFT) { animator.Play(kWalkLAnim); } else if (info.walkDirection == Constants.Direction.RIGHT) { animator.Play(kWalkRAnim); } else if (info.walkDirection == Constants.Direction.UP) { animator.Play(kWalkUAnim); } else if (info.walkDirection == Constants.Direction.DOWN) { animator.Play(kWalkDAnim); } else { // animator.Play(kIdleAnim); animator.speed = 0; } if (footstepSfxs == null) { return; } currentTime += Time.deltaTime * animator.speed; if (currentTime >= footstepDelay) { currentTime -= footstepDelay; currentSfx.value.Enqueue(footstepSfxs.RandomClip()); Debug.Log("STEP " + currentSfx.value.Count); playSfx.Invoke(); } }