private void HandleEnemyShipDestroyed(EnemyShipDestroyedSignal signal) { EnemyAgent next = GetFirstAliveAgentInColumn(signal.FleetCoordinate.ColumnIndex); if (next != null) { next.FireAtWill(); return; } _destroyedColumns++; if (_destroyedColumns == _fleetModel.Length) { _signalBus.Fire <FleetDestroyedSignal>(); } }
private void SpawnColumn(Transform[] spawnPointColumn, int columnIndex) { for (int rowIndex = 0; rowIndex < spawnPointColumn.Length; rowIndex++) { Transform spawnPoint = spawnPointColumn[rowIndex]; EnemyAgent agent = _fleetModel[columnIndex][rowIndex]; if (agent == null) { agent = _container.Instantiate <EnemyAgent>(); _fleetModel[columnIndex][rowIndex] = agent; agent.SetFleetCoordinate(columnIndex, rowIndex); } agent.Reset(); _shipFactory.Create(spawnPoint, agent, // IShipPilot agent); // IShipGunner if (rowIndex == 0) { agent.FireAtWill(); } } }