Example #1
0
        /// <summary>
        /// Fills up our list of all the smartspawnscripts in the scene.
        /// Should be called whenever a new SmartSpawn script is added to the scene
        /// </summary>
        public void GetSmartSpawnReferences()
        {
            //System.Diagnostics.Stopwatch s = new System.Diagnostics.Stopwatch();
            //s.Start();

            allSpawnScripts.Clear();
            allSpawnScripts.AddRange(SmartSpawnScript.FindObjectsOfType(typeof(SmartSpawnScript)) as SmartSpawnScript[]);

            //s.Stop();
            //Debug.LogError("Elapsed time: " + s.Elapsed);
        }
Example #2
0
        void EditorCheckIfWithinRangeOfAny()
        {
            allSpawnScripts = new List <SmartSpawnScript>();
            allSpawnScripts.Clear();
            allSpawnScripts.AddRange(SmartSpawnScript.FindObjectsOfType(typeof(SmartSpawnScript)) as SmartSpawnScript[]);

            int count = 0;

            foreach (SmartSpawnScript s in allSpawnScripts)
            {
                if (IsWithinRange(influenceRange, transform.position, s.transform.position) || influenceAllSmartSpawners)
                {
                    count++;
                }
            }

            Debug.Log("Currently within range of: " + count + " SmartSpawners");
        }