private void SpawnNewWave(int waveIndex) { if (m_currentWave < m_waves.Count) { m_waveShipCount = 0; foreach (var spawnpointId in m_waves[m_currentWave]) { MyScriptWrapper.ActivateSpawnPoint(spawnpointId); MySpawnPoint spawnpoint = MyScriptWrapper.TryGetEntity(spawnpointId) as MySpawnPoint; if (spawnpoint != null) { m_waveShipCount += spawnpoint.GetShipCount(); } } } }
/// <summary> /// Inits destroy counts and hud markers /// </summary> private void Init() { // show asserts for ill defined spawnpoints if (m_toKillSpawnpoints != null) { foreach (var spawnpointId in m_toKillSpawnpoints) { MySpawnPoint spawnpointEntity; if (MyEntities.TryGetEntityById(new MyEntityIdentifier(spawnpointId), out spawnpointEntity)) { Debug.Assert(spawnpointEntity.Activated, "DestroyObjective: spawnpointEntity.Activated == false"); } else { Debug.Assert(spawnpointEntity != null, "DestroyObjective - bad spawnpoint"); } } } m_destroyTotalCount = 0; m_destroyCount = 0; if (m_toKill != null) { foreach (var entityId in m_toKill) { if (!MyScriptWrapper.IsEntityDead(entityId)) { MyEntity entity = MyScriptWrapper.GetEntity(entityId); if (m_showMarks) { MarkAsDestroy(entity); } } else { m_destroyCount++; } m_destroyTotalCount++; } } if (m_toKillSpawnpoints != null) { foreach (var entityId in m_toKillSpawnpoints) { foreach (var bot in MyScriptWrapper.GetSpawnPointBots(entityId)) { if (bot.Ship != null && !bot.Ship.IsDead()) { if (m_showMarks) { MarkAsDestroy(bot.Ship); } } } MySpawnPoint spawnPoint = MyScriptWrapper.GetEntity(entityId) as MySpawnPoint; //int totalForThisSpawnpoint = (spawnPoint.MaxSpawnCount <= 0) ? spawnPoint.GetBots().Count : spawnPoint.MaxSpawnCount; int totalForThisSpawnpoint = spawnPoint.MaxSpawnCount; m_destroyTotalCount += totalForThisSpawnpoint; if (spawnPoint.IsActive()) { int botsToKillCount = spawnPoint.LeftToSpawn + spawnPoint.GetShipCount(); m_destroyCount += totalForThisSpawnpoint - botsToKillCount; } } } }