public IEnumerator InitSpellControl() { while (HeroController.instance == null) { yield return(null); } try { infusionSoundGO = new GameObject("infusionSoundGO", typeof(AudioSource)); DontDestroyOnLoad(infusionSoundGO); focusBurstAnim = HeroController.instance.spellControl.FsmVariables.GetFsmGameObject("Focus Burst Anim").Value; sharpFlash = HeroController.instance.spellControl.FsmVariables.GetFsmGameObject("SD Sharp Flash").Value; //Instantiate(qTrail.Value, HeroController.instance.transform).SetActive(true); spellControl = HeroController.instance.spellControl; PlayMakerFSM dive = HeroController.instance.spellControl; nailArtFSM = HeroController.instance.gameObject.LocateMyFSM("Nail Arts"); FsmGameObject fsmgo = dive.GetAction <CreateObject>("Scream Burst 1", 2).gameObject; fsmgo.Value.gameObject.transform.position = new Vector3(0, 0, 0); fsmgo.Value.gameObject.transform.localPosition = new Vector3(0, -3, 0); dive.GetAction <CreateObject>("Scream Burst 1", 2).gameObject = fsmgo; //Note some of these repeats because after removing an action, their index is pushed backwards to fill in the missing parts spellControl.RemoveAction("Scream Burst 1", 6); // Removes both Scream 1 "skulls" spellControl.RemoveAction("Scream Burst 1", 6); // same spellControl.RemoveAction("Scream Burst 2", 7); //Same but for Scream 2 spellControl.RemoveAction("Scream Burst 2", 7); //Same spellControl.RemoveAction("Level Check 2", 0); //removes the action that takes your soul when you slam spellControl.RemoveAction("Quake1 Land", 9); // Removes slam effect spellControl.RemoveAction("Quake1 Land", 11); // removes pillars spellControl.RemoveAction("Q2 Land", 11); //slam effects spellControl.RemoveAction("Q2 Pillar", 2); //pillars spellControl.RemoveAction("Q2 Pillar", 2); // "Q mega" no idea but removing it otherwise spellControl.InsertAction("Can Cast?", new CallMethod { behaviour = GameManager.instance.GetComponent <SpellControlOverride>(), methodName = "SwapWeapon", parameters = new FsmVar[0], everyFrame = false } , 0); spellControl.InsertAction("Can Cast? QC", new CallMethod { behaviour = GameManager.instance.GetComponent <SpellControlOverride>(), methodName = "CanCastQC", parameters = new FsmVar[0], everyFrame = false } , 0); spellControl.InsertAction("Can Cast? QC", new CallMethod { behaviour = GameManager.instance.GetComponent <SpellControlOverride>(), methodName = "CanCastQC_SkipSpellReq", parameters = new FsmVar[0], everyFrame = false } , 3); //Removes soul requirement //HeroController.instance.spellControl.RemoveAction("Can Cast? QC", 2); spellControl.AddAction("Quake Antic", new CallMethod { behaviour = GameManager.instance.GetComponent <SpellControlOverride>(), methodName = "StartQuake", parameters = new FsmVar[0], everyFrame = false } ); spellControl.AddAction("Quake1 Land", new CallMethod { behaviour = GameManager.instance.GetComponent <SpellControlOverride>(), methodName = "StartTyphoon", parameters = new FsmVar[0], everyFrame = false } ); spellControl.AddAction("Q2 Land", new CallMethod { behaviour = GameManager.instance.GetComponent <SpellControlOverride>(), methodName = "StartTyphoon", parameters = new FsmVar[0], everyFrame = false } ); spellControl.InsertAction("Has Fireball?", new CallMethod { behaviour = GameManager.instance.GetComponent <SpellControlOverride>(), methodName = "SpawnFireball", parameters = new FsmVar[0], everyFrame = false } , 0); spellControl.InsertAction("Has Scream?", new CallMethod { behaviour = GameManager.instance.GetComponent <SpellControlOverride>(), methodName = "HasScream_HasFireSupportAmmo", parameters = new FsmVar[0], everyFrame = false } , 0); spellControl.InsertAction("Has Quake?", new CallMethod { behaviour = GameManager.instance.GetComponent <SpellControlOverride>(), methodName = "HasQuake_CanCastQuake", parameters = new FsmVar[0], everyFrame = false } , 0); spellControl.InsertAction("Scream End", new CallMethod { behaviour = GameManager.instance.GetComponent <SpellControlOverride>(), methodName = "ScreamEnd", parameters = new FsmVar[0], everyFrame = false } , 0); spellControl.InsertAction("Scream End 2", new CallMethod { behaviour = GameManager.instance.GetComponent <SpellControlOverride>(), methodName = "ScreamEnd", parameters = new FsmVar[0], everyFrame = false } , 0); spellControl.RemoveAction("Scream Burst 1", 3); spellControl.RemoveAction("Scream Burst 2", 4); DontDestroyOnLoad(artifactActivatedEffect); } catch (Exception e) { Modding.Logger.Log(e); } }
public IEnumerator InitSpellControl() { while (HeroController.instance == null) { yield return(null); } try { //Get the spellControl and Nail Art FSMs spellControlFSM = HeroController.instance.spellControl; nailArtFSM = HeroController.instance.gameObject.LocateMyFSM("Nail Arts"); //Grimmchild //PlayMakerFSM spawnGrimmChild = GameObject.Find("Charm Effects").LocateMyFSM("Spawn Grimmchild"); //GameObject grimmChild = spawnGrimmChild.GetAction<SpawnObjectFromGlobalPool>("Spawn", 2).gameObject.Value; //PlayMakerFSM grimmChildControl = grimmChild.LocateMyFSM("Control"); //GameObject grimmchildFireball = grimmChildControl.GetAction<SpawnObjectFromGlobalPool>("Shoot", 4).gameObject.Value; //grimmchildFireball.AddComponent<TestBehaviour>(); //grimmChildControl.GetAction<RandomFloat>("Antic", 3).min.Value = 0.1f; //grimmChildControl.GetAction<RandomFloat>("Antic", 3).max.Value = 0.1f; //Makes hatchlings free glowingWombFSM = GameObject.Find("Charm Effects").LocateMyFSM("Hatchling Spawn"); glowingWombFSM.GetAction <IntCompare>("Can Hatch?", 2).integer2.Value = 0; glowingWombFSM.GetAction <Wait>("Equipped", 0).time.Value = 2.5f; glowingWombFSM.RemoveAction("Hatch", 0); //Removes the soul consume on spawn //Modifies Heal Amount, Heal Cost and Heal Speed spellControlFSM.GetAction <SetIntValue>("Set HP Amount", 0).intValue = 0; //Heal Amt spellControlFSM.GetAction <SetIntValue>("Set HP Amount", 2).intValue = 0; //Heal Amt w/ Shape of Unn spellControlFSM.GetAction <GetPlayerDataInt>("Can Focus?", 1).storeValue = 0; //Heal Soul Cost Requirement spellControlFSM.FsmVariables.GetFsmFloat("Time Per MP Drain UnCH").Value = 0.01f; //default: 0.0325 //spellControlFSM.FsmVariables.GetFsmFloat("Time Per MP Drain CH").Value = 0.01f; //TODO: Get rid of the infusion stuff infusionSoundGO = new GameObject("infusionSoundGO", typeof(AudioSource)); DontDestroyOnLoad(infusionSoundGO); //Get focus burst and shade dash flash game objects to spawn later focusBurstAnim = HeroController.instance.spellControl.FsmVariables.GetFsmGameObject("Focus Burst Anim").Value; sharpFlash = HeroController.instance.spellControl.FsmVariables.GetFsmGameObject("SD Sharp Flash").Value; //Instantiate(qTrail.Value, HeroController.instance.transform).SetActive(true); //lowers the scream effects FsmGameObject screamFsmGO = spellControlFSM.GetAction <CreateObject>("Scream Burst 1", 2).gameObject; screamFsmGO.Value.gameObject.transform.position = new Vector3(0, 0, 0); screamFsmGO.Value.gameObject.transform.localPosition = new Vector3(0, -3, 0); spellControlFSM.GetAction <CreateObject>("Scream Burst 1", 2).gameObject = screamFsmGO; //Note some of these repeats because after removing an action, their index is pushed backwards to fill in the missing parts spellControlFSM.RemoveAction("Scream Burst 1", 6); // Removes both Scream 1 "skulls" spellControlFSM.RemoveAction("Scream Burst 1", 6); // ditto spellControlFSM.RemoveAction("Scream Burst 2", 7); //ditto but for Scream 2 (Abyss Shriek) spellControlFSM.RemoveAction("Scream Burst 2", 7); //ditto spellControlFSM.RemoveAction("Level Check 2", 0); //removes the action that takes your soul when you slam spellControlFSM.RemoveAction("Quake1 Land", 9); spellControlFSM.RemoveAction("Quake1 Land", 11); // removes pillars spellControlFSM.RemoveAction("Q2 Land", 11); //slam effects spellControlFSM.RemoveAction("Q2 Pillar", 2); //pillars spellControlFSM.RemoveAction("Q2 Pillar", 2); // "Q mega" no idea but removing it otherwise spellControlFSM.InsertAction("Can Cast?", new CallMethod { behaviour = GameManager.instance.GetComponent <SpellControlOverride>(), methodName = "State_CanCast", parameters = new FsmVar[0], everyFrame = false } , 0); spellControlFSM.InsertAction("Can Cast? QC", new CallMethod { behaviour = GameManager.instance.GetComponent <SpellControlOverride>(), methodName = "State_CanCastQC", parameters = new FsmVar[0], everyFrame = false } , 0); spellControlFSM.InsertAction("Can Cast? QC", new CallMethod { behaviour = GameManager.instance.GetComponent <SpellControlOverride>(), methodName = "CanCastQC_SkipSpellReq", parameters = new FsmVar[0], everyFrame = false } , 3); spellControlFSM.AddAction("Quake1 Land", new CallMethod { behaviour = GameManager.instance.GetComponent <SpellControlOverride>(), methodName = "State_QuakeLand", parameters = new FsmVar[0], everyFrame = false } ); spellControlFSM.AddAction("Q2 Land", new CallMethod { behaviour = GameManager.instance.GetComponent <SpellControlOverride>(), methodName = "State_QuakeLand", parameters = new FsmVar[0], everyFrame = false } ); spellControlFSM.InsertAction("Has Fireball?", new CallMethod { behaviour = GameManager.instance.GetComponent <SpellControlOverride>(), methodName = "SpawnFireball", parameters = new FsmVar[0], everyFrame = false } , 1); spellControlFSM.InsertAction("Has Scream?", new CallMethod { behaviour = GameManager.instance.GetComponent <SpellControlOverride>(), methodName = "HasScream_HasFireSupportAmmo", parameters = new FsmVar[0], everyFrame = false } , 0); spellControlFSM.InsertAction("Has Quake?", new CallMethod { behaviour = GameManager.instance.GetComponent <SpellControlOverride>(), methodName = "HasQuake_CanCastQuake", parameters = new FsmVar[0], everyFrame = false } , 0); spellControlFSM.InsertAction("Scream End", new CallMethod { behaviour = GameManager.instance.GetComponent <SpellControlOverride>(), methodName = "ScreamEnd", parameters = new FsmVar[0], everyFrame = false } , 0); spellControlFSM.InsertAction("Scream End 2", new CallMethod { behaviour = GameManager.instance.GetComponent <SpellControlOverride>(), methodName = "ScreamEnd", parameters = new FsmVar[0], everyFrame = false } , 0); spellControlFSM.RemoveAction("Scream Burst 1", 3); spellControlFSM.RemoveAction("Scream Burst 2", 4); spellControlFSM.InsertAction("Focus Heal", new CallMethod { behaviour = GameManager.instance.GetComponent <SpellControlOverride>(), methodName = "State_FocusHeal", parameters = new FsmVar[0], everyFrame = false } , 0); spellControlFSM.InsertAction("Focus Heal 2", new CallMethod { behaviour = GameManager.instance.GetComponent <SpellControlOverride>(), methodName = "State_FocusHeal", parameters = new FsmVar[0], everyFrame = false } , 0); nailArtFSM.GetAction <ActivateGameObject>("G Slash", 2).activate = false; //For Fan of Knives nailArtFSM.AddAction("G Slash", new CallMethod { behaviour = GameManager.instance.GetComponent <SpellControlOverride>(), methodName = "State_GSlash", parameters = new FsmVar[0], everyFrame = false } ); //Dagger Rain nailArtFSM.AddAction("Cyclone Spin", new CallMethod { behaviour = GameManager.instance.GetComponent <SpellControlOverride>(), methodName = "State_CycloneSpin", parameters = new FsmVar[0], everyFrame = false } ); //Assassinate nailArtFSM.GetAction <ActivateGameObject>("Dash Slash", 0).activate = false; //Disable DSlash nailArtFSM.InsertAction("Dash Slash", new CallMethod { behaviour = GameManager.instance.GetComponent <SpellControlOverride>(), methodName = "State_DashSlash", parameters = new FsmVar[0], everyFrame = false }, 0); } catch (Exception e) { Modding.Logger.Log(e); } }
private void Start() { if (!PlayerData.instance.infectedKnightDreamDefeated) { return; } if (!LostLord.Instance.IsInHall) { return; } Log(_changedKin); if (!_changedKin) { tk2dSpriteDefinition def = gameObject.GetComponent <tk2dSprite>().GetCurrentSpriteDef(); _oldTex = def.material.mainTexture; def.material.mainTexture = LostLord.SPRITES[0].texture; _changedKin = true; } _origFps = _origFps ?? _anim.Library.clips.Select(x => x.fps).ToArray(); PlayMakerFSM corpse = gameObject.FindGameObjectInChildren("Corpse Infected Knight Dream(Clone)").LocateMyFSM("corpse"); corpse.RemoveAction("Init", 9); corpse.RemoveAction("Init", 1); corpse.ChangeTransition("Pause", "FINISHED", "BG Open"); corpse.AddAction("Pause", corpse.GetAction <Tk2dPlayAnimation>("Blow", 9)); // Refill MP HeroController.instance.AddMPChargeSpa(999); // No stunning Destroy(_stunControl); // 🅱lood _enemyEffects.SetAttr("noBlood", true); // No balloons _balloons.ChangeTransition("Spawn Pause", "SPAWN", "Stop"); // 1500hp _hm.hp = 1500; // Disable Knockback _recoil.enabled = false; // 2x Damage on All Components foreach (DamageHero i in gameObject.GetComponentsInChildren <DamageHero>(true)) { Log(i.name); i.damageDealt *= 2; } // Speed up some attacks. foreach (KeyValuePair <string, float> i in _fpsDict) { _anim.GetClipByName(i.Key).fps = i.Value; } // Decrease idles _control.GetAction <WaitRandom>("Idle", 5).timeMax = 0.01f; _control.GetAction <WaitRandom>("Idle", 5).timeMin = 0.001f; // 2x Damage _control.GetAction <SetDamageHeroAmount>("Roar End", 3).damageDealt.Value = 2; // Increase Jump X _control.GetAction <FloatMultiply>("Aim Dstab", 3).multiplyBy = 5; _control.GetAction <FloatMultiply>("Aim Jump", 3).multiplyBy = 2.2f; // Decrease walk idles. var walk = _control.GetAction <RandomFloat>("Idle", 3); walk.min = 0.001f; walk.max = 0.01f; // Speed up _control.GetAction <Wait>("Jump", 5).time = 0.01f; _control.GetAction <Wait>("Dash Antic 2", 2).time = 0.27f; // Fall faster. _control.GetAction <SetVelocity2d>("Dstab Fall", 4).y = -200; // -130; // -90 _control.GetAction <SetVelocity2d>("Dstab Fall", 4).everyFrame = true; _control.GetAction <ActivateGameObject>("Dstab Land", 2).activate = false; _control.GetAction <ActivateGameObject>("Dstab Fall", 6).activate = false; // Combo Dash into Upslash followed by Dstab's Projectiles. _control.CopyState("Dstab Land", "Spawners"); _control.CopyState("Ohead Slashing", "Ohead Combo"); _control.CopyState("Dstab Recover", "Dstab Recover 2"); _control.ChangeTransition("Dash Recover", "FINISHED", "Ohead Combo"); _control.RemoveAnim("Dash Recover", 3); _control.RemoveAnim("Spawners", 3); _control.ChangeTransition("Ohead Combo", "FINISHED", "Spawners"); _control.ChangeTransition("Spawners", "FINISHED", "Dstab Recover 2"); _control.GetAction <Wait>("Dstab Recover 2", 0).time = 0f; List <FsmStateAction> a = _control.GetState("Dstab Fall").Actions.ToList(); a.AddRange(_control.GetState("Spawners").Actions); _control.GetState("Dstab Fall").Actions = a.ToArray(); // Spawners before Overhead Slashing. _control.CopyState("Spawners", "Spawn Ohead"); _control.ChangeTransition("Ohead Antic", "FINISHED", "Spawn Ohead"); _control.ChangeTransition("Spawn Ohead", "FINISHED", "Ohead Slashing"); _control.FsmVariables.GetFsmFloat("Evade Range").Value *= 2; // Dstab => Upslash _control.CopyState("Ohead Slashing", "Ohead Combo 2"); _control.ChangeTransition("Dstab Land", "FINISHED", "Ohead Combo 2"); _control.ChangeTransition("Ohead Combo 2", "FINISHED", "Dstab Recover"); // Aerial Dash => Dstab _control.ChangeTransition("Dash Recover", "FALL", "Dstab Antic"); // bingo bongo ur dash is now lightspeed _control.FsmVariables.GetFsmFloat("Dash Speed").Value *= 2; _control.FsmVariables.GetFsmFloat("Dash Reverse").Value *= 2; // Fixes the cheese where you can sit on the wall // right above where he can jump and then just spam ddark _control.CopyState("Jump", "Cheese Jump"); _control.GetAction <Wait>("Cheese Jump", 5).time.Value *= 5; _control.RemoveAction("Cheese Jump", 4); _control.InsertAction("Cheese Jump", new FireAtTarget { gameObject = new FsmOwnerDefault { GameObject = gameObject }, target = HeroController.instance.gameObject, speed = 100f, everyFrame = false, spread = 0f, position = new Vector3(0, 0) }, 4); foreach (string i in new[] { "Damage Response", "Attack Choice" }) { _control.InsertMethod(i, 0, StopCheese); } Log("fin."); }
public void CR_Change_Room_temple(Scene scene) { if (scene.name != "Room_temple") { return; } Log("CR_Change_Room_temple()"); //yield return null; #region Hornet NPC FSM GameObject hornetNpcGo = scene.FindRoot("Hornet Black Egg NPC"); PlayMakerFSM hornetNpcFsm = hornetNpcGo.LocateMyFSM("Conversation Control"); FsmVariables hornetNpcFsmVar = hornetNpcFsm.FsmVariables; hornetNpcFsm.CopyState("Greet", "Give Item"); hornetNpcFsm.RemoveAction("Give Item", 0); hornetNpcFsm.GetAction <CallMethodProper>("Give Item", 0).parameters = new FsmVar[] { new FsmVar(typeof(string)) { stringValue = "CUSTOM_HORNET_PRE_FINAL_BATTLE" }, new FsmVar(typeof(string)) { stringValue = "Hornet" } }; var pdbtAction = new PlayerDataBoolTest(); pdbtAction.gameObject = hornetNpcFsm.GetAction <PlayerDataBoolTest>("Choice", 1).gameObject; pdbtAction.boolName = "SFGrenadeTestOfTeamworkHornetCompanion"; pdbtAction.isFalse = FsmEvent.GetFsmEvent("ABSENT"); hornetNpcFsm.InsertAction("Choice", pdbtAction, 1); hornetNpcFsm.AddTransition("Choice", "ABSENT", "Give Item"); #endregion #region Shiny FSM GameObject shinyParent = GameObject.Instantiate(PrefabHolder.shinyPrefab); shinyParent.name = "Necklace"; shinyParent.SetActive(false); shinyParent.transform.GetChild(0).gameObject.SetActive(true); shinyParent.transform.position = new Vector3(29.0f, 4.3f, 0.0f); hornetNpcFsm.CopyState("Box Up", "Give Item Spawn"); hornetNpcFsm.ChangeTransition("Give Item Spawn", FsmEvent.Finished.Name, "Talk Finish"); hornetNpcFsm.GetState("Give Item").Transitions.First(x => x.ToState == "Talk Finish").ToState = "Give Item Spawn"; hornetNpcFsm.RemoveAction("Give Item Spawn", 5); hornetNpcFsm.RemoveAction("Give Item Spawn", 4); hornetNpcFsm.RemoveAction("Give Item Spawn", 3); hornetNpcFsm.RemoveAction("Give Item Spawn", 2); hornetNpcFsm.RemoveAction("Give Item Spawn", 1); hornetNpcFsm.RemoveAction("Give Item Spawn", 0); var agoAction = new ActivateGameObject(); agoAction.gameObject = new FsmOwnerDefault(); agoAction.gameObject.OwnerOption = OwnerDefaultOption.SpecifyGameObject; agoAction.gameObject.GameObject = shinyParent; agoAction.activate = true; agoAction.recursive = false; agoAction.resetOnExit = false; agoAction.everyFrame = false; hornetNpcFsm.AddAction("Give Item Spawn", agoAction); hornetNpcFsm.AddAction("Give Item Spawn", new NextFrameEvent() { sendEvent = FsmEvent.Finished }); PlayMakerFSM shinyFsm = shinyParent.transform.GetChild(0).gameObject.LocateMyFSM("Shiny Control"); FsmVariables shinyFsmVars = shinyFsm.FsmVariables; shinyFsmVars.FindFsmInt("Charm ID").Value = 0; shinyFsmVars.FindFsmInt("Type").Value = 0; shinyFsmVars.FindFsmBool("Activated").Value = false; shinyFsmVars.FindFsmBool("Charm").Value = false; shinyFsmVars.FindFsmBool("Dash Cloak").Value = false; shinyFsmVars.FindFsmBool("Exit Dream").Value = false; shinyFsmVars.FindFsmBool("Fling L").Value = false; shinyFsmVars.FindFsmBool("Fling On Start").Value = true; shinyFsmVars.FindFsmBool("Journal").Value = false; shinyFsmVars.FindFsmBool("King's Brand").Value = false; shinyFsmVars.FindFsmBool("Mantis Claw").Value = false; shinyFsmVars.FindFsmBool("Pure Seed").Value = false; shinyFsmVars.FindFsmBool("Quake").Value = false; shinyFsmVars.FindFsmBool("Show Charm Tute").Value = false; shinyFsmVars.FindFsmBool("Slug Fling").Value = false; shinyFsmVars.FindFsmBool("Super Dash").Value = false; shinyFsmVars.FindFsmString("Item Name").Value = Consts.LanguageStrings.HornetInvNameKey; shinyFsmVars.FindFsmString("PD Bool Name").Value = "SFGrenadeTestOfTeamworkHornetCompanion"; IntSwitch isAction = shinyFsm.GetAction <IntSwitch>("Trinket Type", 0); var tmpCompareTo = new List <FsmInt>(isAction.compareTo); tmpCompareTo.Add(tmpCompareTo.Count + 1); isAction.compareTo = tmpCompareTo.ToArray(); shinyFsmVars.FindFsmInt("Trinket Num").Value = tmpCompareTo.Count; var tmpSendEvent = new List <FsmEvent>(isAction.sendEvent); tmpSendEvent.Add(FsmEvent.FindEvent("PURE SEED")); isAction.sendEvent = tmpSendEvent.ToArray(); shinyFsm.CopyState("Love Key", "Necklace"); shinyFsm.GetAction <SetPlayerDataBool>("Necklace", 0).boolName = "SFGrenadeTestOfTeamworkHornetCompanion"; shinyFsm.GetAction <SetSpriteRendererSprite>("Necklace", 1).sprite = TestOfTeamwork.Instance.SpriteDict.Get(TextureStrings.InvHornetKey); shinyFsm.GetAction <GetLanguageString>("Necklace", 2).convName = Consts.LanguageStrings.HornetInvNameKey; shinyFsm.AddTransition("Trinket Type", "PURE SEED", "Necklace"); #endregion Log("~CR_Change_Room_temple()"); }
private void FixedUpdate() { if (canStart > 0) { canStart -= Time.fixedDeltaTime; } else if (canStart > -10f) { canStart = -999f; _control.RemoveAction("In Air", 1); _control.RemoveAction("In Air", 1); _control.GetAction <Wait>("In Air", 3).time = 0.2f; _control.ChangeTransition("Do Sphere?", "CANCEL", "ADash Antic"); _control.RemoveAction("Do Sphere?", 0); //_control.RemoveAction("Do Sphere?", 0); try { _control.GetAction <BoolTest>("Do Sphere?", 0).isTrue = null; _control.InsertCoroutine("Do Sphere?", 1, SphereCheck); } catch (System.Exception e) { Log(e); } } else if (canStart == -999f) { if (_control.ActiveStateName == "In Air" && !canSphere) { num++; // Log("Dont Sphere"); } if (num > 45) { canSphere = true; //Log("can sphere"); num = 0; _control.ChangeTransition("In Air", "AIRDASH", "Do Sphere?"); } } if (finalPhase) { HeroController.instance.ClearMP(); if (_hm.hp <= 300 && !firstFinal2) { firstFinal2 = true; textExample.text = "I pity you no more..."; try { _control.GetAction <FireAtTarget>("Fire", 3).speed = 42f; _control.GetAction <SetVelocityAsAngle>("Fire", 4).speed = 42f; _control.GetAction <SetVelocity2d>("G Dash", 5).x = 30f; } catch (System.Exception e) { Log(e); } _anim.GetClipByName("Sphere Antic A Q").fps = 14; _anim.GetClipByName("Wall Impact").fps = 35; _anim.GetClipByName("A Dash Antic Q").fps = 40; _anim.GetClipByName("G Dash Antic Q").fps = 40; } if (trick) { gameObject.transform.SetPosition2D(29f, 28.6f); HeroController.instance.transform.SetPosition2D(20f, 28.4f); } else { if (firstFinal) { textExample.text = "Stop those worthless spells ghost"; _control.ChangeTransition("Throw", "FINISHED", "Throw Recover"); //_control.RemoveAction("Throw Recover", 3); _control.ChangeTransition("Throw Recover", "FINISHED", "Jump"); try { // _control.GetAction<Wait>("Sphere A", 5).time = 1f; // _control.GetAction<Wait>("Sphere", 5).time = 1f; _control.GetAction <FireAtTarget>("Fire", 3).speed = 36f; _control.GetAction <SetVelocityAsAngle>("Fire", 4).speed = 36f; _control.GetAction <SetVelocity2d>("G Dash", 5).x = 30f; } catch (System.Exception e) { Log(e); } _anim.GetClipByName("Sphere Antic A Q").fps = 14; _anim.GetClipByName("Wall Impact").fps = 35; _anim.GetClipByName("A Dash Antic Q").fps = 34; _anim.GetClipByName("G Dash Antic Q").fps = 34; _control.InsertMethod("Sphere", 0, SetMantisThrow); _control.InsertMethod("Sphere A", 0, SetMantisThrow); _control.InsertCoroutine("Throw", 0, orbThrow); _control.InsertCoroutine("CA Recover", 0, FireBatThrow); _control.AddAction("CA Antic", new FaceObject { objectA = gameObject, objectB = HeroController.instance.gameObject, spriteFacesRight = false, playNewAnimation = false, resetFrame = false, everyFrame = false }); try { _control.GetAction <Wait>("G Dash", 9).time = 0.5f; // _control.GetAction<DecelerateXY>("GDash Recover1", 3).decelerationX = 0.0f; //_control.GetAction<DecelerateXY>("GDash Recover2", 2).decelerationX = 0.0f; } catch (System.Exception e) { Log(e); } _control.InsertCoroutine("G Dash", 1, FireDash); var lookAtKnight = _control.GetAction <FaceObject>("GDash Antic", 2); _control.InsertAction("G Dash", new FaceObject { objectA = lookAtKnight.objectA, objectB = lookAtKnight.objectB, spriteFacesRight = lookAtKnight.spriteFacesRight, playNewAnimation = lookAtKnight.playNewAnimation, newAnimationClip = lookAtKnight.newAnimationClip, resetFrame = lookAtKnight.resetFrame, everyFrame = lookAtKnight.everyFrame }, 0); _control.ChangeTransition("GDash Recover2", "FINISHED", "CA Antic"); firstFinal = false; } if (timeFocusing <= 0f) { //var rand = Random.Range(0, 2); timeFocusing = 8f; if (isFocus) { isFocus = false; StartCoroutine(randFocus()); } else { isFocus = true; StartCoroutine(DestroyBeeBrain()); } } else { timeFocusing -= Time.fixedDeltaTime; } } } if (_hm.hp <= 1800 && _hm.hp > 1300) { if ((needles[9].transform.GetPositionX() > 40 || needles[9].transform.GetPositionX() < 12) && dang) { dang = false; for (int i = 0; i < needles.Length; i++) { needles[i].transform.SetPosition2D(i * 2.6f + 15f, 45); needles[i].GetComponent <Rigidbody2D>().rotation = 90f; needles[i].GetComponent <Rigidbody2D>().velocity = new Vector2(0, -30f); } } } if (_hm.hp <= 1300 && _hm.hp > 800) { if (!secondPhase) { try { // _control.GetAction<Wait>("Sphere A", 5).time = 1f; // _control.GetAction<Wait>("Sphere", 5).time = 1f; _control.GetAction <FireAtTarget>("Fire", 3).speed = 35f; _control.GetAction <SetVelocityAsAngle>("Fire", 4).speed = 35f; } catch (System.Exception e) { Log(e); } _anim.GetClipByName("Wall Impact").fps = 25; _anim.GetClipByName("A Dash Antic Q").fps = 30; _control.GetAction <SetPosition>("Throw", 5).vector = new Vector3(50f, 50f, 0f); _control.RemoveAction("Throw", 5); _control.GetAction <ActivateGameObject>("Throw", 5).activate = false; firstPhase = false; _control.ChangeTransition("Barb?", "BARB", "Can Throw?"); wave = Instantiate(DoH.wavePref); wave.SetActive(true); Log("Do da grubber throw boiu"); _control.InsertMethod("CA Recover", 0, grubberAttack); _control.ChangeTransition("Move Choice B", "G DASH", "CA Antic"); _control.InsertCoroutine("Throw", 0, grubberAttack2); IEnumerator GrubFill() { if (secondPhase) { height = gameObject.transform.GetPositionY() + 5f; for (int i = 0, d = 5, a = 0; i < 5; i++, d++, a += 2) { try { Log("E for everyone"); grubAll[i] = Instantiate(DoH.grubRPref); Destroy(grubAll[i].LocateMyFSM("Control")); Destroy(grubAll[i].LocateMyFSM("damages_enemy")); grubAll[i].transform.SetPosition2D(gameObject.transform.GetPositionX(), height - a); grubAll[i].AddComponent <DamageHero>(); grubAll[i].GetComponent <DamageHero>().damageDealt *= 2; grubAll[i].SetActive(true); grubAll[i].GetComponent <Rigidbody2D>().velocity = new Vector2(0f, 0f); height = gameObject.transform.GetPositionY() + 5f; grubAll[d] = Instantiate(DoH.grubLPref); Destroy(grubAll[d].LocateMyFSM("Control")); Destroy(grubAll[d].LocateMyFSM("damages_enemy")); grubAll[d].transform.SetPosition2D(gameObject.transform.GetPositionX(), height - a); grubAll[d].AddComponent <DamageHero>(); grubAll[d].GetComponent <DamageHero>().damageDealt *= 2; grubAll[d].SetActive(true); grubAll[d].GetComponent <Rigidbody2D>().velocity = new Vector2(0f, 0f); } catch (System.Exception e) { Log(e); } yield return(null); } } yield return(new WaitForSeconds(0.2f)); for (int i = 0, a = 5; i < 5; i++, a++) { grubAll[i].GetComponent <Rigidbody2D>().velocity = new Vector2(20f, -5f); grubAll[a].GetComponent <Rigidbody2D>().velocity = new Vector2(-20f, -5f); yield return(null); } } _control.InsertCoroutine("Sphere", 0, GrubFill); _control.InsertCoroutine("Sphere A", 0, GrubFill); textExample.text = "I can't let you win ghost."; secondPhase = true; } //Make lava particle follow her wave.transform.SetPosition2D(gameObject.transform.GetPositionX(), gameObject.transform.GetPositionY()); } if (_hm.hp <= 800) { if (!finalPhase && _control.ActiveStateName != "Idle") { _control.GetAction <WaitRandom>("Idle", 9).timeMax = 3f; _control.GetAction <WaitRandom>("Idle", 9).timeMin = 3f; _control.GetAction <Tk2dPlayAnimation>("Idle", 4).clipName = "Stun"; _control.RemoveAction("Idle", 8); _control.RemoveAction("Idle", 7); //_control.SetState("Idle"); } else if (!finalPhase && _control.ActiveStateName == "Idle") { HeroController.instance.takeNoDamage = true; secondPhase = false; trick = true; Destroy(wave); textExample.text = "Queens of Hallownest, give me strength"; finalPhase = true; gameObject.transform.SetPosition2D(29f, 28.6f); if (gameObject.transform.localScale.x > 0) { gameObject.transform.localScale = new Vector3(-1f * gameObject.transform.localScale.x, gameObject.transform.localScale.y, gameObject.transform.localScale.z); } try { go1.SetActive(false); go2.SetActive(false); } catch (System.Exception e) { Log(e); } StartCoroutine(tricky()); } } if (HeroController.instance.cState.focusing && _control.transform.GetPositionY() < 29) { textExample.text = "Healing is for the weak ghost"; _control.SetState("G Dash 2"); } if (!textExample.text.Equals("")) { timeLeft -= Time.deltaTime; } if (timeLeft <= 0f) { textExample.text = ""; timeLeft = 2f; } }
public IEnumerator Revek() { GameObject revek = Object.Instantiate ( ObjectLoader.InstantiableObjects["Revek"], HeroController.instance.gameObject.transform.position, Quaternion.identity ); yield return(new WaitForSecondsRealtime(1)); Object.DontDestroyOnLoad(revek); revek.SetActive(true); PlayMakerFSM ctrl = revek.LocateMyFSM("Control"); // Make sure init gets to run. yield return(null); // Actually spawn. ctrl.SetState("Appear Pause"); // ReSharper disable once ImplicitlyCapturedClosure (ctrl) ctrl.AddAction("Hit", new InvokeMethod(() => Object.Destroy(revek))); // ReSharper disable once ImplicitlyCapturedClosure (ctrl) void OnUnload() { if (revek == null) { return; } revek.SetActive(false); } void OnLoad(Scene a, Scene b) { try { if (revek == null) { return; } revek.SetActive(true); ctrl.SetState("Appear Pause"); } catch { Object.Destroy(revek); } } GameManager.instance.UnloadingLevel += OnUnload; USceneManager.activeSceneChanged += OnLoad; yield return(new WaitForSecondsRealtime(30)); Object.Destroy(revek); GameManager.instance.UnloadingLevel -= OnUnload; USceneManager.activeSceneChanged -= OnLoad; }
private void AddChestShot() { string[] states = { "ChestShot Antic", "ChestShot Rise", "ChestShot", "ChestShot Pause", "ChestShot Fall", "ChestShot Recover" }; for (int i = 0; i < states.Length; i++) { string state = states[i]; _control.CreateState(state); _control.AddTransition(state, FsmEvent.Finished, i + 1 < states.Length ? states[i + 1] : "Idle Stance" ); } IEnumerator ChestShotAntic() { gameObject.GetComponent<Rigidbody2D>().isKinematic = false; _anim.Play("ChestShot Antic"); yield return new WaitForSeconds(_anim.GetClipByName("ChestShot Antic").Duration); } _control.InsertCoroutine("ChestShot Antic", 0, ChestShotAntic); IEnumerator ChestShotRise() { _anim.Play("ChestShot"); gameObject.GetComponent<Rigidbody2D>().gravityScale = 0f; gameObject.FindGameObjectInChildren("Idle").SetActive(false); gameObject.FindGameObjectInChildren("ChestShot").SetActive(true); GameCameras.instance.cameraShakeFSM.SendEvent("EnemyKillShake"); var rb = gameObject.GetComponent<Rigidbody2D>(); float y = transform.position.y + 4; _trail.Pause(); rb.velocity = transform.up * 4.20f; while (transform.position.y < y) { yield return null; } rb.velocity = Vector3.zero; _trail.Play(); yield return new WaitForSeconds(0.85f); } _control.InsertCoroutine("ChestShot Rise", 0, ChestShotRise); IEnumerator ChestShot() { GameCameras.instance.cameraShakeFSM.Fsm.GetFsmBool("RumblingMed").Value = true; Quaternion down = Quaternion.Euler(Vector3.down); Quaternion right = Quaternion.Euler(Vector3.right); for (int _ = 0; _ < 6; _++) { for (float i = 29.3f; i <= 61.7f; i += 4.6f) { Instantiate(SilentLongLifetime, new Vector3(i, 20), down) .GetComponent<Rigidbody2D>() .velocity = new Vector2(0, -10); } for (float i = 6.4f; i <= 20f; i += 4f) { Instantiate(SilentLongLifetime, new Vector3(29.3f, i), right) .GetComponent<Rigidbody2D>() .velocity = new Vector2(10, 0); } yield return new WaitForSeconds(.75f); } } _control.InsertCoroutine("ChestShot", 0, ChestShot); _control.InsertMethod("ChestShot Pause", 0, () => { GameCameras.instance.cameraShakeFSM.Fsm.GetFsmBool("RumblingMed").Value = false; }); _control.AddAction("ChestShot Pause", new Wait { time = 0.75f, finishEvent = FsmEvent.Finished }); IEnumerator ChestShotFall() { _anim.Play("Jump"); gameObject.GetComponent<Rigidbody2D>().gravityScale = _control.Fsm.GetFsmFloat("Gravity Scale").Value; // Floor level while (transform.position.y >= 9.5) { yield return null; } } _control.InsertCoroutine("ChestShot Fall", 0, ChestShotFall); IEnumerator ChestShotRecover() { _anim.Play("FallToStun"); GameCameras.instance.cameraShakeFSM.SendEvent("AverageShake"); gameObject.FindGameObjectInChildren("Stun").SetActive(true); yield return new WaitForSeconds(2); _anim.Play("StunToIdle"); gameObject.FindGameObjectInChildren("Stun").SetActive(false); gameObject.FindGameObjectInChildren("Idle").SetActive(true); yield return new WaitForSeconds(_anim.GetClipByName("StunToIdle").Duration); } _control.InsertCoroutine("ChestShot Recover", 0, ChestShotRecover); _control.GetAction<SendRandomEventV3>("Choice P3").AddToSendRandomEventV3("ChestShot Antic", .2f, 1, 5); }