Example #1
0
        private static IEnumerator FixUumuu()
        {
            yield return(null);

            // Find Uumuu and the FSM
            GameObject uumuu = GameObject.Find("Mega Jellyfish");

            if (uumuu == null)
            {
                yield break;
            }

            PlayMakerFSM fsm = uumuu.LocateMyFSM("Mega Jellyfish");

            // Fix the waits and the number of attacks
            fsm.GetState("Idle").GetAction <WaitRandom>().timeMax   = 1.5f;
            fsm.GetState("Set Timer").GetAction <RandomFloat>().max = 2f;
            fsm.FsmVariables.GetFsmFloat("Quirrel Time").Value      = 4f;

            // Fix the pattern to 2 quick, then 1 long if it still needs to attack
            FsmState choice = fsm.GetState("Choice");

            choice.RemoveAction <SendRandomEventV2>();
            choice.AddMethod(() => SetUumuuPattern(fsm));

            // Reset the multizap counter to 0 so the pattern remains 2 quick 1 optional long
            fsm.GetState("Recover").AddMethod(() => fsm.FsmVariables.GetFsmInt("Ct Multizap").Value = 0);

            // Set the initial RecoilSpeed to 0 so that dream nailing her on the first cycle doesn't push her
            uumuu.GetComponent <Recoil>().SetRecoilSpeed(0);

            // Set her HP to 1028 value
            uumuu.GetComponent <HealthManager>().hp = 250;
        }
Example #2
0
        private void AddDashTele()
        {
            ParticleSystem.MainModule main = _trail.main;
            var psr = _trail.GetComponent<ParticleSystemRenderer>();

            bool tele = false;

            IEnumerator TeleOut()
            {
                tele = false;

                // After Tele can transition here if the Tele fails so I want to reset the trail regardless.
                if (main.startColor.color == Color.black)
                {
                    psr.material.shader = Shader.Find("Legacy Shaders/Particles/Additive");
                    main.startColor = Color.white;
                    _trail.Play();
                }

                if (_hm.hp > HP * 2 / 3) yield break;
                if (_rand.Next(0, 2) == 0) yield break;

                tele = true;

                psr.material.shader = Shader.Find("Legacy Shaders/Particles/Multiply");
                main.startColor = Color.black;

                yield return new WaitForSeconds(.20f);

                _anim.Stop();

                _trail.Pause();

                _control.SetState("Tele Out Dash");
            }

            _control.CreateState("Dash Wall");

            // ReSharper disable once ImplicitlyCapturedClosure
            void ConditionalEvent()
            {
                if (tele)
                {
                    _control.SetState("Tele Out Dash");
                }
            }

            FsmState dashWall = _control.GetState("Dash Wall");
            FsmState dash = _control.GetState("Dash");

            dashWall.AddMethod(ConditionalEvent);

            _control.ChangeTransition("Dash", "WALL", "Dash Wall");

            dashWall.AddTransition(FsmEvent.Finished, "Dash Recover");

            dash.AddCoroutine(TeleOut);

            _control.CopyState("Tele Out", "Tele Out Dash");
            _control.CopyState("TelePos Slash", "TelePos DashOut");
            _control.CopyState("Tele In", "Tele In Dash");
            
            dash.AddTransition("TELE", "Tele Out Dash");
            
            var dashCont = _control.CreateState("Dash Continue");
            
            _control.ChangeTransition("Tele Out Dash", "FINISHED", "TelePos DashOut");
            _control.ChangeTransition("TelePos DashOut", "FINISHED", "Tele In Dash");
            _control.ChangeTransition("Tele In Dash", "FINISHED", "Dash Continue");

            _control.GetAction<SetStringValue>("TelePos DashOut").stringValue = "DASH";

            IEnumerator ResumeDash()
            {
                psr.material.shader = Shader.Find("Legacy Shaders/Particles/Additive");
                main.startColor = Color.white;

                _trail.Play();

                Vector3 scale = transform.localScale;

                scale.x =
                (
                    Math.Abs(transform.localScale.x) *
                    Math.Sign(HeroController.instance.transform.position.x - transform.position.x)
                );
                
                transform.localScale = scale;

                gameObject.GetComponent<Rigidbody2D>().velocity = new Vector2(60 * Math.Sign(transform.localScale.x), 0);

                _anim.Play("Dash");

                yield return new WaitForSeconds(.15f);

                _anim.Stop();
            }

            dashCont.InsertCoroutine(0, ResumeDash);

            dashCont.AddTransition(FsmEvent.Finished, "Dash Recover");
        }