예제 #1
0
            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;
            }
예제 #2
0
 public override void OnFixedUpdate(CatController controller)
 {
     if (controller._rigidbody.velocity.sqrMagnitude > .1f)
     {
         controller.ChangeState(new MovingState());
     }
 }
예제 #3
0
            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));
            }
예제 #4
0
 public virtual void OnStateExit(CatController controller)
 {
 }
예제 #5
0
 public virtual void OnStateEnter(CatController controller)
 {
 }
예제 #6
0
 public abstract void OnFixedUpdate(CatController controller);
예제 #7
0
 public override void OnStateExit(CatController controller)
 {
     controller.regularTrail.SetActive(false);
 }
예제 #8
0
 public override void OnStateEnter(CatController controller)
 {
     controller.regularTrail.SetActive(true);
 }
예제 #9
0
            private IEnumerator DisableKicked(CatController controller)
            {
                yield return(new WaitForSeconds(controller.trailTime));

                controller.ChangeState(new MovingState());
            }
예제 #10
0
 public override void OnStateExit(CatController controller)
 {
     controller.animator.SetBool(Kicked, false);
     controller.StopAllCoroutines();
     controller.StartCoroutine(FadeOutTrail(controller));
 }