コード例 #1
0
        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()");
        }
コード例 #2
0
        public void Start()
        {
            if (type == Type.FLOOR)
            {
                GameObject actualBlocker = GameObject.Instantiate(PrefabHolder.popQuakeFloorPrefab, transform.parent, true);
                actualBlocker.SetActive(false);
                actualBlocker.transform.position    = transform.position;
                actualBlocker.transform.localScale  = transform.lossyScale;
                actualBlocker.transform.eulerAngles = transform.eulerAngles;

                var t  = actualBlocker.Find("Active").transform;
                var t2 = gameObject.Find("Active").transform;
                for (int c = t2.childCount - 1; c >= 0; c--)
                {
                    t2.GetChild(c).SetParent(t, true);
                }
                t  = actualBlocker.Find("Inactive").transform;
                t2 = gameObject.Find("Inactive").transform;
                for (int c = t2.childCount - 1; c >= 0; c--)
                {
                    t2.GetChild(c).SetParent(t, true);
                }
                actualBlocker.Find("Inactive").SetActive(false);

                var blockerFsm = actualBlocker.LocateMyFSM("quake_floor");
                if (blockerFsm.GetState("Init").Fsm == null)
                {
                    blockerFsm.Preprocess();
                }
                blockerFsm.SetAttr("fsmTemplate", (FsmTemplate)null);
                var blockerFsmVars = blockerFsm.FsmVariables;
                blockerFsmVars.GetFsmBool("Glass").Value             = false;
                blockerFsmVars.GetFsmString("Playerdata Bool").Value = pdBool;

                DestroyObject doAction = new DestroyObject
                {
                    gameObject     = blockerFsmVars.GetFsmGameObject("Inactive"),
                    delay          = 0.0f,
                    detachChildren = true
                };
                var agoAction = new ActivateGameObject
                {
                    gameObject = new FsmOwnerDefault
                    {
                        OwnerOption = OwnerDefaultOption.SpecifyGameObject,
                        GameObject  = blockerFsmVars.GetFsmGameObject("Inactive")
                    },
                    activate    = false,
                    recursive   = false,
                    resetOnExit = false,
                    everyFrame  = false
                };
                blockerFsm.AddAction("Destroy", agoAction);
                blockerFsm.AddAction("Destroy", doAction);

                blockerFsm.RemoveAction("Activate", 0);
                blockerFsm.AddAction("Activate", new SetBoolValue()
                {
                    boolVariable = blockerFsmVars.GetFsmBool("Activated"),
                    boolValue    = true,
                    everyFrame   = false
                });
                blockerFsm.AddAction("Activate", new ActivateGameObject()
                {
                    gameObject = new FsmOwnerDefault()
                    {
                        OwnerOption = OwnerDefaultOption.SpecifyGameObject,
                        GameObject  = blockerFsmVars.GetFsmGameObject("Active")
                    },
                    activate    = false,
                    recursive   = false,
                    resetOnExit = false,
                    everyFrame  = false
                });
                blockerFsm.AddAction("Activate", new ActivateGameObject()
                {
                    gameObject = new FsmOwnerDefault()
                    {
                        OwnerOption = OwnerDefaultOption.SpecifyGameObject,
                        GameObject  = blockerFsmVars.GetFsmGameObject("Inactive")
                    },
                    activate    = true,
                    recursive   = false,
                    resetOnExit = false,
                    everyFrame  = false
                });
                blockerFsm.AddAction("Activate", new SetCollider()
                {
                    gameObject = new FsmOwnerDefault()
                    {
                        OwnerOption = OwnerDefaultOption.UseOwner
                    },
                    active = false
                });
                blockerFsm.AddAction("Init", new PlayerDataBoolTest()
                {
                    gameObject = new FsmOwnerDefault()
                    {
                        OwnerOption = OwnerDefaultOption.SpecifyGameObject,
                        GameObject  = GameManager.instance.gameObject
                    },
                    boolName = blockerFsmVars.GetFsmString("Playerdata Bool"),
                    isTrue   = FsmEvent.GetFsmEvent("ACTIVATE"),
                    isFalse  = FsmEvent.Finished
                });
                blockerFsm.RemoveAction("Init", 0);
                blockerFsm.RemoveAction("PD Bool?", 0);

                blockerFsm.SetState("Pause");

                blockerFsm.MakeLog(true);

                actualBlocker.SetActive(true);
                Object.Destroy(gameObject);
            }
            else if (type == Type.WALL)
            {
            }
        }