public void Init() { foreach (EnemyConfig enemyConfig in enemyInitData.EnemySpawns) { Transform transform = Object.Instantiate(enemyInitData.Prefab, enemyConfig.Position, enemyConfig.Rotation); var entity = world.NewEntity(); var config = enemyConfig; ref EnemyComponent component = ref entity.Set <EnemyComponent>(); component.RadiusDetection = enemyConfig.RadiusDetection; if (config.Gun != null) { AddGun(transform, ref component, ref config); } AddOtherComponents(transform, ref entity, ref config); enemyInitData = null; }
public EnemySpawnSystem(EnemyInitData enemyInitData) { this.enemyInitData = enemyInitData; }