コード例 #1
0
        public GameObject Spawn()
        {
            if (!this.enabled)
            {
                return(null);
            }
            if (_spawnedAttachment != null)
            {
                this.Despawn();
            }

            int index = SpawnPointHelper.SelectFromMultiple(this, this.PrefabCount);

            if (index < 0 || index >= this.PrefabCount)
            {
                return(null);
            }

            var prefab = _prefabs[index];

            _spawnedAttachment = _spawnMechanism.Spawn(prefab, this.transform.position, this.transform.rotation, this.transform);

            if (_onSpawnedObject != null && _onSpawnedObject.Count > 0)
            {
                _onSpawnedObject.ActivateTrigger(this, _spawnedAttachment);
            }

            return(_spawnedAttachment);
        }
コード例 #2
0
        public GameObject Spawn()
        {
            if (!this.enabled)
            {
                return(null);
            }

            int index = SpawnPointHelper.SelectFromMultiple(this, this.PrefabCount);

            if (index < 0 || index >= this.PrefabCount)
            {
                return(null);
            }

            return(this.Spawn(_prefabs[index]));
        }
コード例 #3
0
        protected GameObject SelectPrefab(GameObject[] prefabs)
        {
            if (!this.enabled)
            {
                return(null);
            }

            int index = SpawnPointHelper.SelectFromMultiple(this, prefabs.Length);

            if (index < 0 || index >= prefabs.Length)
            {
                return(null);
            }

            return(prefabs[index]);
        }