Esempio n. 1
0
        public static List <GameObject> SimpleSpawnObjects(this IActor spawner, List <GameObject> objectToSpawn)
        {
            if (objectToSpawn == null || !objectToSpawn.Any())
            {
                return(null);
            }

            var spawnData = new ActorSpawnerSettings
            {
                objectsToSpawn           = objectToSpawn,
                SpawnPosition            = SpawnPosition.UseSpawnerPosition,
                parentOfSpawns           = TargetType.None,
                runSpawnActionsOnObjects = true,
                destroyAbilityAfterSpawn = true
            };

            return(ActorSpawn.Spawn(spawnData, spawner, null));
        }
Esempio n. 2
0
        public void SpawnPerk(IActor target)
        {
            var spawn    = target.GameObject.AddComponent <AbilityActorSpawn>();
            var perkData = new ActorSpawnerSettings
            {
                objectsToSpawn = new List <GameObject> {
                    perkPrefab
                },
                SpawnPosition            = SpawnPosition.UseSpawnerPosition,
                parentOfSpawns           = TargetType.None,
                runSpawnActionsOnObjects = true,
                destroyAbilityAfterSpawn = true
            };

            spawn.SpawnData = perkData;
            var targetActorEntity = target.ActorEntity;

            spawn.AddComponentData(ref targetActorEntity, target);
            spawn.Execute();
        }