示例#1
0
        /// <summary>
        /// Instantiates prefabs on the specific group.
        /// </summary>
        public void SpawnSpecific(SpawnGroup group, Actor caller, bool isForced = false)
        {
            if (group == null)
            {
                return;
            }

            foreach (var actor in SpawnAndReturn(group, caller, isForced))
            {
            }
        }
示例#2
0
        /// <summary>
        /// Instantiates and returns prefabs on all spawn points.
        /// </summary>
        public IEnumerable <GameObject> SpawnAndReturn(SpawnGroup group, Actor caller, bool isForced = false)
        {
            if (!isForced && Time.timeSinceLevelLoad - _lastTime < MinInterval)
            {
                return(_empty);
            }

            _lastTime = Time.timeSinceLevelLoad;

            if (PrefabOverride == null || PrefabOverride.Length == 0)
            {
                return(group.SpawnAndReturn(Random.Range(MinCount, MaxCount), caller, true));
            }
            else
            {
                return(group.SpawnAndReturn(Random.Range(MinCount, MaxCount), PrefabOverride, caller, true));
            }
        }