Example #1
0
        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;
            }
Example #2
0
 public EnemySpawnSystem(EnemyInitData enemyInitData)
 {
     this.enemyInitData = enemyInitData;
 }