private IEnumerator FadeOutTrail(CatController controller) { var start = Time.time; var end = start + controller.trailFadeTime; var particles = controller.kickedTrail.GetComponent <ParticleSystem>(); var main = particles.main; var colourGradient = main.startColor; var startColour = colourGradient.color; while (Time.time < end) { var t = (Time.time - start) / controller.trailFadeTime; var v = Tween.SmoothStop3(1, 0, t); var alpha = startColour.a * v; var colour = startColour; colour.a = alpha; colourGradient.color = colour; main.startColor = colourGradient; yield return(null); } controller.kickedTrail.SetActive(false); colourGradient.color = startColour; main.startColor = colourGradient; }
public override void OnFixedUpdate(CatController controller) { if (controller._rigidbody.velocity.sqrMagnitude > .1f) { controller.ChangeState(new MovingState()); } }
public override void OnStateEnter(CatController controller) { controller.animator.SetBool(Kicked, true); controller.StopAllCoroutines(); var particles = controller.kickedTrail.GetComponent <ParticleSystem>(); var main = particles.main; var colour = main.startColor; colour.color = controller._kickTrailStartColour; main.startColor = colour; controller.kickedTrail.SetActive(true); controller.StartCoroutine(DisableKicked(controller)); }
public virtual void OnStateExit(CatController controller) { }
public virtual void OnStateEnter(CatController controller) { }
public abstract void OnFixedUpdate(CatController controller);
public override void OnStateExit(CatController controller) { controller.regularTrail.SetActive(false); }
public override void OnStateEnter(CatController controller) { controller.regularTrail.SetActive(true); }
private IEnumerator DisableKicked(CatController controller) { yield return(new WaitForSeconds(controller.trailTime)); controller.ChangeState(new MovingState()); }
public override void OnStateExit(CatController controller) { controller.animator.SetBool(Kicked, false); controller.StopAllCoroutines(); controller.StartCoroutine(FadeOutTrail(controller)); }