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()"); }