예제 #1
0
        /// <summary>
        /// Updates the list of save games from the character drop down selection
        /// </summary>
        /// <param name="SelectedIndex">Index of the character that has been selected.</param>
        public void ChangeCharacter(int SelectedIndex)
        {
            CurrentCharacter = SelectedIndex;

            // remove previous buttons
            if (SaveGameCreatedButtonList.Count > 0)
            {
                foreach (GameObject child in SaveGameCreatedButtonList)
                {
                    DestroyImmediate(child);
                }
            }

            // load all save games for this character from the datalayer
            SaveGameCreatedButtonList = new List <GameObject>();
            SelectedSlotID            = AllCharacters[SelectedIndex].Value;
            //SaveGamesForSelectedCharacter = GlobalFuncs.TheDatabase().GetShortList("vSaveGames", "ID", new string[] { "CreatedOn", "Level", "XP", "SceneName" }, "CreatedOn", true, "SlotID", SelectedSlotID.ToString(), false, "^");
            SaveGamesForSelectedCharacter = GlobalFuncs.TheDatabase().GetSaveGameListForSlot(SelectedSlotID);

            // clone a button from the master for each save game
            foreach (SimpleDataPair sdp in SaveGamesForSelectedCharacter)
            {
                GameObject LoadButton = Instantiate(LoadGameScrollItem);
                LoadButton.transform.SetParent(LoadGameScrollable.transform);

                Text     LoadButtonText = LoadButton.GetComponentInChildren <Text>();
                string[] sdpSplit       = sdp.Display.Split('~');
                LoadButtonText.text = sdpSplit[0].Replace('T', ' ') + " (Lvl " + sdpSplit[1] + " XP " + sdpSplit[2] + ") " + sdpSplit[3];

                Button LoadActualButton = LoadButton.GetComponent <Button>();
                LoadActualButton.onClick.AddListener(() => { LoadGame(sdp.Value); });

                LoadButton.SetActive(true);
                SaveGameCreatedButtonList.Add(LoadButton);
            }
        }
예제 #2
0
        /// <summary>
        /// Delay then return to the magic pool (or destroy if pool not enabled).
        /// </summary>
        /// <returns>IEnujmerator until the delay has passed.</returns>
        IEnumerator DelayedReturnToPool()
        {
            yield return(new WaitForSeconds(Delay));                      // wait

            GlobalFuncs.ReturnToThePoolOrDestroy(PoolSlotID, gameObject); // send back to the pool
        }
예제 #3
0
        /// <summary>
        /// Disable the main menu and redraw the character display.
        /// </summary>
        void OnEnable()
        {
            // deactivate main menu
            if (ParentMenu)
            {
                ParentMenu.SetActive(false);
            }

            if (!ScreenDrawnAlready)
            {  // draw the full display on first open
#if !VANILLA
                control = GetComponentInParent <vInventory>();
#endif
                if (Header && AttributeIcon && AttributeName && AttributeValue)
                {
                    DefHeaderTXT = Header.gameObject.GetComponent <Text>();
                    DefAttribTXT = AttributeName.gameObject.GetComponent <Text>();
                    DefValueTXT  = AttributeValue.gameObject.GetComponent <Text>();
                    DefPlusTXT   = AttributeSpendPlus.gameObject.GetComponent <Text>();
                    if (DefHeaderTXT && DefAttribTXT && DefValueTXT && DefPlusTXT)
                    {
                        GameObject player = GlobalFuncs.FindPlayerInstance();
                        if (player)
                        {
                            levelingSystem = player.GetComponent <CharacterBase>();
                            if (levelingSystem)
                            {  // all required components found, draw the stats with labels
                                CurrentPane = -1;
                                reDrawAttributes();
                                ScreenDrawnAlready = true;
                            }
                            else
                            {
                                if (GlobalFuncs.DEBUGGING_MESSAGES)
                                {
                                    Debug.Log("Player Leveling System NOT found");
                                }
                            }
                        }
                        else
                        {
                            if (GlobalFuncs.DEBUGGING_MESSAGES)
                            {
                                Debug.Log("Player NOT found");
                            }
                        }
                    }
                    else
                    {
                        if (GlobalFuncs.DEBUGGING_MESSAGES)
                        {
                            Debug.Log("GUI Text component is required on the default header/attribute name objects");
                        }
                    }
                }
                else
                {
                    if (GlobalFuncs.DEBUGGING_MESSAGES)
                    {
                        Debug.Log("Default UI rect transforms NOT set");
                    }
                }
            }
            else
            {  // already have the components
                reDrawAttributes();
            }
        }
예제 #4
0
 /// <summary>
 /// Simple run the spawn loop with delays (from other spawner's).
 /// </summary>
 void Start()
 {
     CoDelayedSpawn = StartCoroutine(GlobalFuncs.SpawnAllDelayed(SpawnMe, Delay, NoneSequential, transform, gameObject, iPoolSlotID, ForceFaceTrigger, Target));  // trigger all traps the the array
 }
예제 #5
0
        /// <summary>
        /// Occurs when the new game menu option is clicked.
        /// </summary>
        public void NewGame()
        {
            if (CharacterNameTextBox.text.Length > 2)
            {
                ValidationLabel.text = "";
                if (FirstSceneName.Length > 0)
                {
                    // find the leveling system
                    if (!LevelingSystem)
                    {
                        GameObject player = GlobalFuncs.FindPlayerInstance();
                        if (player)
                        {
                            LevelingSystem = player.GetComponent <CharacterBase>();
                        }
                        else
                        {
                            if (GlobalFuncs.DEBUGGING_MESSAGES)
                            {
                                Debug.Log("Unable to find player");
                            }
                        }
                    }
                    if (!LevelingSystem)
                    {  // not found?
                        if (GlobalFuncs.DEBUGGING_MESSAGES)
                        {
                            Debug.Log("Leveling system not found on player");
                        }
                    }
                    else
                    {  // all good
                        // set the leveling system initial values
                        LevelingSystem.CurrentLevel     = 1;
                        LevelingSystem.Name             = CharacterNameTextBox.text;
                        LevelingSystem.CurrentAxis      = (BaseAxis)AxisDropDown.value;
                        LevelingSystem.CurrentAlignment = (BaseAlignment)AlignDropDown.value;
                        LevelingSystem.CurrentRace      = (BaseRace)RaceDropDown.value;
                        LevelingSystem.CurrentClass     = (BaseClass)ClassDropDown.value;
                        LevelingSystem.ResetToDefaults(); // reset character to the selection
                        LevelingSystem.reCalcCore(true);  // recalc the core stats, max out health etc
                        CharacterNameTextBox.text = "";   // clear for mid game create new character

                        // create a new slot and first save game in the data layer
                        LevelingSystem.SaveSlotID     = 0;
                        LevelingSystem.LastSaveGameID = GlobalFuncs.TheDatabase().SavePlayerState(ref LevelingSystem, FirstSceneName, -1);
                        GlobalFuncs.TheDatabase().ClearInventoryAndHUD();

                        // close the menu and load the scene
#if !VANILLA
                        Inventory.gameObject.SetActive(true);
#endif
                        NewCharacterWindow.SetActive(false);
                        Fader.BeginFade(1);
                        isOpen    = false;
                        lockInput = false;
                        Fader.LoadSceneAsync(FirstSceneName);  // start the load with progress bar
                    }
                }
                else
                {
                    if (GlobalFuncs.DEBUGGING_MESSAGES)
                    {
                        Debug.Log("First scene name is not specified");
                    }
                }
            }
            else
            {
                ValidationLabel.text = "Missing Character Name..";
            }
        }
예제 #6
0
        /// <summary>
        /// Save the game and load the next scene when collider trigger entered by the player.
        /// </summary>
        /// <param name="other">Collider that has entered the trigger.</param>
        void OnTriggerEnter(Collider other)
        {
            if (other.gameObject.tag.Equals("Player"))
            {     // only player can trigger
                if (SceneToLoad != "")
                { // fail safe
                    // spawn all
                    if (SpawnOnEnter.Count > 0)
                    {
                        StartCoroutine(GlobalFuncs.SpawnAllDelayed(SpawnOnEnter, SpawnDelay, NoneSequentialSpawns, transform, null, 0, false, SpawnTarget.Any));  // trigger all spawns the the array
                    }

                    // save to data layer
                    LevelingSystem = other.gameObject.GetComponent <CharacterBase>();
                    if (!LevelingSystem)
                    {  // not found?
                        if (GlobalFuncs.DEBUGGING_MESSAGES)
                        {
                            Debug.Log("Leveling system not found on player");
                        }
                    }
                    else
                    {  // all good
                       // save the game
                        LevelingSystem.LastSaveGameID = GlobalFuncs.TheDatabase().SavePlayerState(ref LevelingSystem, SceneToLoad, -1);
                        MainMenu MainMenuSystem = GlobalFuncs.TheMainMenu();
                        if (MainMenuSystem)
                        {
                            MainMenuSystem.LatestSaveGameID = LevelingSystem.LastSaveGameID;

                            // confirm save to user
                            MainMenuSystem.SaveGameMessage.CrossFadeAlpha(1f, 0.01f, true);
                            MainMenuSystem.SaveGameMessage.text = "Save Complete..";
                            MainMenuSystem.SaveGameMessage.CrossFadeAlpha(0f, 3f, true);

                            // load the next scene
                            MainMenu_FadingLoad Fader = MainMenuSystem.gameObject.GetComponent <MainMenu_FadingLoad>();
                            if (Fader)
                            {
                                Fader.BeginFade(1);
                                Fader.LoadSceneAsync(SceneToLoad, LoadDelay);  // start the load with progress bar
                            }
                            else
                            {
                                if (GlobalFuncs.DEBUGGING_MESSAGES)
                                {
                                    Debug.Log("Main menu system NOT found in scene");
                                }
                            }
                        }
                        else
                        {
                            if (GlobalFuncs.DEBUGGING_MESSAGES)
                            {
                                Debug.Log("Main menu system NOT found in scene");
                            }
                        }
                    }
                }
                else
                {
                    if (GlobalFuncs.DEBUGGING_MESSAGES)
                    {
                        Debug.Log("Scene to load is NOT set");
                    }
                }
            }
        }
예제 #7
0
        /// <summary>
        /// Inspector custom GUI override
        /// </summary>
        public override void OnInspectorGUI()
        {
#if !VANILLA
            oldSkin = GUI.skin;
            if (skin)
            {
                GUI.skin = skin;
            }
#endif
            GUILayout.BeginVertical("CHARACTER ATTRIBUTES", "window");
#if !VANILLA
            GUILayout.Label(m_Logo, GUILayout.MaxHeight(25));
#endif
            // grab the underlying class instance
            CharacterBase cc = (CharacterBase)target;

            // show values + modifier
            bOpenCloseWindow = GUILayout.Toggle(bOpenCloseWindow, bOpenCloseWindow ? "Close" : "Open", EditorStyles.toolbarButton);
            if (bOpenCloseWindow)
            {
                // reset to defaults
                GUILayout.BeginHorizontal();
                if (GUILayout.Button("Reset to Defaults", GUILayout.ExpandWidth(true)))
                {
                    cc.ConditionsRoot = cc.transform.Find("Conditions");
                    cc.ResetToDefaults();
                }
                GUILayout.EndHorizontal();

                // feed stats into the animator
                GUILayout.BeginHorizontal();
#if !VANILLA
                GUI.skin = oldSkin;
#endif
                GUILayout.Label("Send Stats", GUILayout.Width(75));
                cc.FeedStatsToAnimator = GUILayout.Toggle(cc.FeedStatsToAnimator, " to the Animator", GUILayout.ExpandWidth(true));
#if !VANILLA
                GUI.skin = skin;
#endif
                GUILayout.EndHorizontal();

                // increase by
                GUILayout.BeginHorizontal();
#if !VANILLA
                GUI.skin = oldSkin;
#endif
                GUILayout.Label("Increase By", GUILayout.Width(75));
                CurrentIncrease = (BaseIncrease)EditorGUILayout.EnumPopup(CurrentIncrease, GUILayout.ExpandWidth(true));
#if !VANILLA
                GUI.skin = skin;
#endif
                GUILayout.EndHorizontal();

                // core foldout
                GUILayout.BeginVertical(EditorStyles.helpBox);
                GUILayout.BeginHorizontal();
#if !VANILLA
                GUI.skin = oldSkin;
#endif
                bShowCore = GUILayout.Toggle(bShowCore, "Core Attributes", "Foldout", GUILayout.ExpandWidth(true));
                GUILayout.EndHorizontal();
                if (bShowCore)
                {
                    GUICoreDisplay(ref cc);
                }
#if !VANILLA
                GUI.skin = skin;
#endif
                GUILayout.EndVertical();

                // collectables foldout
                GUILayout.BeginVertical(EditorStyles.helpBox);
                GUILayout.BeginHorizontal();
#if !VANILLA
                GUI.skin = oldSkin;
#endif
                bShowCollectables = GUILayout.Toggle(bShowCollectables, "Collectables", "Foldout", GUILayout.ExpandWidth(true));
                GUILayout.EndHorizontal();
                if (bShowCollectables)
                {
                    for (int i = 0; i < cc.Collectables.Count; i++)
                    {
                        // name
                        GUILayout.BeginHorizontal();
                        GUILayout.Label(cc.Collectables[i].Type.ToString(), GUILayout.Width(75));

                        // allow value modification
                        GUIGenericValueDisplay(ref cc, ref cc.Collectables[i].Value, 0, -1);

                        // current value
                        GUI.skin.label.alignment = TextAnchor.UpperRight;
                        GUILayout.Label(cc.Collectables[i].Value.ToString("#,##0"), GUILayout.ExpandWidth(true));
                        GUI.skin.label.alignment = TextAnchor.UpperLeft;
                        GUILayout.EndHorizontal();

                        // only the player sees the collectable prefabs config as are global
                        if (cc.gameObject.tag == "Player")
                        {
                            // temp initialise for our existing scenes
                            if (cc.Collectables[i].Spawns == null)
                            {
                                cc.Collectables[i].Spawns = new List <CollectablePrefab>();
                            }  // remove b4 release

                            // list all prefabs
                            for (int s = 0; s < cc.Collectables[i].Spawns.Count; s++)
                            {
                                GUILayout.BeginHorizontal();
                                GUILayout.Space(10);

                                // prefab
                                GUILayout.Label("Prefab", GUILayout.Width(65));
                                cc.Collectables[i].Spawns[s].Prefab = EditorGUILayout.ObjectField(cc.Collectables[i].Spawns[s].Prefab, typeof(GameObject), false) as GameObject;

                                // amount
                                GUILayout.Label(" = ", GUILayout.Width(20));
                                cc.Collectables[i].Spawns[s].Amount = (int)EditorGUILayout.FloatField(cc.Collectables[i].Spawns[s].Amount, GUILayout.Width(35));
                                if (cc.Collectables[i].Spawns[s].Amount < 1)
                                {
                                    cc.Collectables[i].Spawns[s].Amount = 1;
                                }

                                // remove
                                if (GUILayout.Button("X", GUILayout.Width(30)))
                                {
                                    cc.Collectables[i].Spawns.RemoveAt(s);
                                    break;  // drop out till next editor frame
                                }
                                GUILayout.EndHorizontal();
                            }

                            // add more
                            GUILayout.BeginHorizontal();
                            GUILayout.Space(75);
                            if (GUILayout.Button("Add Prefab/Value", GUILayout.ExpandWidth(true)))
                            {
                                cc.Collectables[i].Spawns.Add(new CollectablePrefab());
                            }
                            GUILayout.EndHorizontal();
                        }
                    }
                }
#if !VANILLA
                GUI.skin = skin;
#endif
                GUILayout.EndVertical();


                // skill points foldout
                if (cc.Skills != null)
                {
                    GUILayout.BeginVertical(EditorStyles.helpBox);
                    GUILayout.BeginHorizontal();
#if !VANILLA
                    GUI.skin = oldSkin;
#endif
                    bShowSkillPoints = GUILayout.Toggle(bShowSkillPoints, "Skill Points", "Foldout", GUILayout.ExpandWidth(true));
                    GUILayout.EndHorizontal();
                    if (bShowSkillPoints)
                    {
                        // available skill points
                        GUILayout.BeginHorizontal();
                        GUILayout.Label("Unspent", GUILayout.Width(75));
                        if (cc.UnspentSkillPoints > 0)
                        {
                            if (GUILayout.Button("Seq", GUILayout.Width(64)))
                            {
                                cc.DistributePoints(false);
                            }
                            if (GUILayout.Button("Rnd", GUILayout.Width(64)))
                            {
                                cc.DistributePoints(true);
                            }
                        }
                        GUILayout.Label(cc.UnspentSkillPoints.ToString(), GUILayout.ExpandWidth(true));
                        GUILayout.EndHorizontal();

                        // skill point list
                        for (int i = 0; i < cc.Skills.Count; i++)
                        {
                            GUILayout.BeginHorizontal();
                            GUISkillPointDisplay(ref cc, ref i);
                            GUILayout.EndHorizontal();
                        }
                    }
#if !VANILLA
                    GUI.skin = skin;
#endif
                    GUILayout.EndVertical();
                }

                // resistances foldout
                if (cc.Resist != null)
                {
                    GUILayout.BeginVertical(EditorStyles.helpBox);
                    GUILayout.BeginHorizontal();
#if !VANILLA
                    GUI.skin = oldSkin;
#endif
                    bShowResistances = GUILayout.Toggle(bShowResistances, "Resistances", "Foldout", GUILayout.ExpandWidth(true));
                    GUILayout.EndHorizontal();
                    if (bShowResistances)
                    {
                        for (int i = 0; i < cc.Resist.Count; i++)
                        {
                            // attribute name
                            GUILayout.BeginHorizontal();
                            GUILayout.Label(cc.Resist[i].Resist.ToString(), GUILayout.Width(75));

                            // allow value modification
                            GUIGenericValueDisplay(ref cc, ref cc.Resist[i].Value, 0, 100);

                            // current value
                            GUI.skin.label.alignment = TextAnchor.UpperRight;
                            GUILayout.Label("(" + (cc.ResistModTotals[i].Value > 0 ? "+" : "") + cc.ResistModTotals[i].Value.ToString() + ") " + cc.Resist[i].Value.ToString() + '%', GUILayout.ExpandWidth(true));
                            GUI.skin.label.alignment = TextAnchor.UpperLeft;
                            GUILayout.EndHorizontal();
                        }
                    }
#if !VANILLA
                    GUI.skin = skin;
#endif
                    GUILayout.EndVertical();
                }

                // conditions foldout
                if (cc.Conditions != null)
                {
                    GUILayout.BeginVertical(EditorStyles.helpBox);
                    GUILayout.BeginHorizontal();
#if !VANILLA
                    GUI.skin = oldSkin;
#endif
                    bShowConditions = GUILayout.Toggle(bShowConditions, "Elemental Conditions", "Foldout", GUILayout.ExpandWidth(true));
                    GUILayout.EndHorizontal();
                    if (bShowConditions)
                    {
                        for (int i = 0; i < cc.Conditions.Count; i++)
                        {
                            if (cc.Conditions[i].Type != BaseDamage.Physical)  // ignore physical
                            {
                                // attribute name
                                GUILayout.BeginHorizontal();
                                GUILayout.Label(cc.Conditions[i].Type.ToString(), GUILayout.Width(75));

                                // display
                                //GUILayout.Label("Display", GUILayout.Width(65));
                                cc.Conditions[i].Display = EditorGUILayout.ObjectField(cc.Conditions[i].Display, typeof(GameObject), false) as GameObject;
                                GUILayout.EndHorizontal();
                            }
                        }
                    }
#if !VANILLA
                    GUI.skin = skin;
#endif
                    GUILayout.EndVertical();
                }

                // data layer helper functions
                if (cc.gameObject.tag == "Player")
                {
                    bOpenDataHelpers = GUILayout.Toggle(bOpenDataHelpers, bOpenDataHelpers ? "Close Data Layer Helpers" : "Open Data Layer Helpers", EditorStyles.toolbarButton);
                    if (bOpenDataHelpers)
                    {
                        // attempt find data layer
                        if (!GlobalFuncs.TheDatabase())
                        {
                            GUILayout.Label("Data layer NOT found..", GUILayout.ExpandWidth(true));
                            GUILayout.Label("Add a data layer connector..", GUILayout.ExpandWidth(true));
                            GUILayout.Label("E.g. CharacterDataSQLLite!", GUILayout.ExpandWidth(true));
                        }
                        else
                        {
                            // reset to defaults
                            GUILayout.BeginHorizontal();
                            if (GUILayout.Button("Validate DB", GUILayout.ExpandWidth(true)))
                            {
                                GlobalFuncs.TheDatabase().ValidateDatabase(false);
                            }
                            if (GUILayout.Button("Wipe DB", GUILayout.ExpandWidth(true)))
                            {
                                GlobalFuncs.TheDatabase().ValidateDatabase(true);
                                SaveSlots         = null; // force reload
                                SaveGames         = null; // of slot/save shortlists
                                cc.SaveSlotID     = 0;
                                cc.LastSaveGameID = 0;
                            }
                            GUILayout.EndHorizontal();

                            //// slot choice
                            //GUILayout.BeginHorizontal();
                            //GUILayout.Label("Save Slot", GUILayout.Width(60));
                            //if (SaveSlots == null) {
                            //    SaveSlots = GlobalFuncs.TheDatabase().GetShortList("SaveSlots", "ID", new string[] { "CharacterName", "CreatedOn" }, "CreatedOn", true, "", "", true, " :: ");
                            //}
                            //iNewValue = GlobalFuncs.TheDatabase().SimpleDataGUIPopup(ref SaveSlots, cc.SaveSlotID, GUILayout.ExpandWidth(true));
                            //if (cc.SaveSlotID != iNewValue) {
                            //    cc.SaveSlotID = iNewValue;
                            //    SaveGames = null;  // force reload of dependant save game list
                            //}

                            //// save choice dependant upon slot
                            //GUILayout.Label("Save Game", GUILayout.Width(75));
                            //if (SaveGames == null) {
                            //    SaveGames = GlobalFuncs.TheDatabase().GetShortList("SaveGames", "ID", new string[] { "CreatedOn" }, "CreatedOn", true, "SlotID", cc.SaveSlotID.ToString(), true, " :: ");
                            //}
                            //cc.LastSaveGameID = GlobalFuncs.TheDatabase().SimpleDataGUIPopup(ref SaveGames, cc.LastSaveGameID, GUILayout.ExpandWidth(true));
                            //GUILayout.EndHorizontal();

                            //GUILayout.BeginHorizontal();
                            //if (cc.LastSaveGameID > 0) {
                            //    if (GUILayout.Button("Load", GUILayout.ExpandWidth(true))) {
                            //        GlobalFuncs.TheDatabase().LoadPlayerState(ref cc, false, cc.LastSaveGameID);
                            //    }
                            //}
                            //if (GUILayout.Button("Save", GUILayout.ExpandWidth(true))) {
                            //    cc.LastSaveGameID = GlobalFuncs.TheDatabase().SavePlayerState(ref cc, SceneManager.GetActiveScene().name, (cc.LastSaveGameID > 0 ? cc.LastSaveGameID : - 1));
                            //    SaveSlots = null;  // force reload
                            //    SaveGames = null;  // of slot/save shortlists
                            //}
                            //GUILayout.EndHorizontal();
                        }
                    }
                }
            }
            GUILayout.EndVertical();
#if !VANILLA
            GUI.skin = oldSkin;
#endif
        }
예제 #8
0
        /// <summary>
        /// Occurs when the animator enters the parent state, creates hand particles and targeting.
        /// </summary>
        /// <param name="animator">Reference to the parent animator.</param>
        /// <param name="stateInfo">Information about the state.</param>
        /// <param name="layerIndex">Index of the current animator layer.</param>
        public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
        {
            // set the magic spawn point
            if (!tMagicSpawn)
            {
                bAI = !(animator.gameObject.tag == "Player");
                if (!bAI)
                {
                    tMagicSpawn = animator.GetComponentInChildren <MagicSettings>().MagicSpawnPoint;
                }
                else
                {
                    tMagicSpawn = animator.GetComponentInChildren <MagicAI>().MagicSpawnPoint;
                }
            }

            // handle the hand particle
            if (SpellOptions.LimbParticleEffect && !goLimb1_ParticleInstance)
            {                                                                                                                      // enabled, present and not already active?
                if (GlobalFuncs.MAGICAL_POOL && !SpellOptions.DoNotPoolLimbParticles)
                {                                                                                                                  // pooling enabled?
                    if (iLimbPoolSlotID1 > 0)
                    {                                                                                                              // pool slot already known
                        goLimb1_ParticleInstance = GlobalFuncs.TheMagicalPool().GatherFromPool(iLimbPoolSlotID1 - 1, tMagicSpawn); // load from the pool
                    }
                    else
                    {
                        goLimb1_ParticleInstance = GlobalFuncs.TheMagicalPool().GatherFromPool(ref iLimbPoolSlotID1, SpellOptions.LimbParticleEffect, tMagicSpawn, SpawnTarget.Any); // load from the pool
                    }
                    goLimb1_ParticleInstance.SetActive(true);                                                                                                                        // enable as will be returned from the pool disabled
                }
                else
                {                                                                            // pool disabled
                    goLimb1_ParticleInstance = Instantiate(SpellOptions.LimbParticleEffect); // load from the prefab
                }
                if (SpellOptions.attackLimb != SpellOptions.attackLimb2)
                {                                                                                                                          // dont create a second particle if both limbs the same
                    if (GlobalFuncs.MAGICAL_POOL && !SpellOptions.DoNotPoolLimbParticles)
                    {                                                                                                                      // pooling enabled?
                        if (SpellOptions.LimbParticleEffect2)
                        {                                                                                                                  // does limb 2 has a different particle effect?
                            if (iLimbPoolSlotID2 > 0)
                            {                                                                                                              // pool slot already known
                                goLimb2_ParticleInstance = GlobalFuncs.TheMagicalPool().GatherFromPool(iLimbPoolSlotID2 - 1, tMagicSpawn); // load from the pool
                            }
                            else
                            {
                                goLimb2_ParticleInstance = GlobalFuncs.TheMagicalPool().GatherFromPool(ref iLimbPoolSlotID2, SpellOptions.LimbParticleEffect2, tMagicSpawn, SpawnTarget.Any);  // load from the pool
                            }
                        }
                        else
                        {                                                                                                                  // nope
                            if (iLimbPoolSlotID1 > 0)
                            {                                                                                                              // pool slot already known
                                goLimb2_ParticleInstance = GlobalFuncs.TheMagicalPool().GatherFromPool(iLimbPoolSlotID1 - 1, tMagicSpawn); // load from the pool
                            }
                            else
                            {
                                goLimb2_ParticleInstance = GlobalFuncs.TheMagicalPool().GatherFromPool(ref iLimbPoolSlotID1, SpellOptions.LimbParticleEffect, tMagicSpawn, SpawnTarget.Any);  // load from the pool
                            }
                        }
                        goLimb2_ParticleInstance.SetActive(true);  // enable as will be returned from the pool disabled
                    }
                    else
                    {                                                                                                                                                    // pool disabled
                        goLimb2_ParticleInstance = Instantiate((SpellOptions.LimbParticleEffect2 ? SpellOptions.LimbParticleEffect2 : SpellOptions.LimbParticleEffect)); // load from the prefab
                    }
                }
            }

            // spawn all immediate if charge state
            if (SpellOptions.ChargeState)
            {                                                                                                                                                          // spawn over time all as long as not the charge state
                foreach (SpawnerOptionsOverTime sootSpawnMe in SpellOptions.SpawnOverTime)
                {                                                                                                                                                      // process all spawns immediate
                    if (sootSpawnMe.UseRootTransform)
                    {                                                                                                                                                  // ground based effect?
                        sootSpawnMe.goSpawnedParticle = sootSpawnMe.Spawn(animator.rootPosition, Quaternion.identity, (bAI ? SpawnTarget.Friend : SpawnTarget.Enemy)); // spawn
                    }
                    else
                    {                                                                                                                   // negative, use the magic spawn point
                        sootSpawnMe.goSpawnedParticle = sootSpawnMe.Spawn(tMagicSpawn, (bAI ? SpawnTarget.Friend : SpawnTarget.Enemy)); // spawn
                    }
                }
            }
        }
예제 #9
0
 /// <summary>
 /// Trigger the entire spawn trap array directly via delgate or script
 /// </summary>
 public void ManualTriggerTrap()
 {
     StartCoroutine(GlobalFuncs.SpawnAllDelayed(Traps, Delay, NoneSequential, transform, null, 0, ForceFaceTrigger, Target));  // trigger all traps the array
 }