public void RemoveExplodableReference(ExplodableType a_type, Explodable a_explodable) { List <Explodable> referenceList = GetList(a_type); #if UNITY_EDITOR // Ensure object is referenced if (!_explodables.Contains(a_explodable) || !referenceList.Contains(a_explodable)) { Debug.LogWarning(string.Format("(Scene Manager) Attempted remove to reference '{0}' when not already referenced", a_explodable.name)); return; } #endif referenceList.Remove(a_explodable); _explodables.Remove(a_explodable); // Raise player win/loss event if objectives are met switch (a_type) { case ExplodableType.Sheep: if (_player.explosionCount <= 0 && sheepCount > 0 && _generators.Count > 0) { // HACK: Fixes bug where having no explodables with // an explosions left fails player Invoke("NoExplosionsLeftFailure", 1.0f); } else if (sheepCount <= 0) { RaisePlayerWinEvent(PlayerWinState.AllSheepDestroyed); } break; case ExplodableType.NuclearSheep: RaisePlayerLossEvent(PlayerLoseState.DetonatedNukeSheep); break; case ExplodableType.Crate: break; case ExplodableType.Generator: if (generatorsCount <= 0) { RaisePlayerWinEvent(PlayerWinState.AllGeneratersDestroyed); } break; } }
public void AddExplodableReference(ExplodableType a_type, Explodable a_explodable) { List <Explodable> referenceList = GetList(a_type); #if UNITY_EDITOR // Ensure object isn't already referenced if (_explodables.Contains(a_explodable) || referenceList.Contains(a_explodable)) { Debug.LogWarning(string.Format("(Scene Manager) Attempted to reference '{0}' when already referenced", a_explodable.name)); return; } #endif referenceList.Add(a_explodable); _explodables.Add(a_explodable); }
List <Explodable> GetList(ExplodableType a_type) { switch (a_type) { case ExplodableType.Sheep: return(_sheep); case ExplodableType.NuclearSheep: return(_nukeSheep); case ExplodableType.Crate: return(_crates); case ExplodableType.Generator: return(_generators); } return(null); }
List<Explodable> GetList(ExplodableType a_type) { switch (a_type) { case ExplodableType.Sheep: return _sheep; case ExplodableType.NuclearSheep: return _nukeSheep; case ExplodableType.Crate: return _crates; case ExplodableType.Generator: return _generators; } return null; }
public void RemoveExplodableReference(ExplodableType a_type, Explodable a_explodable) { List<Explodable> referenceList = GetList(a_type); #if UNITY_EDITOR // Ensure object is referenced if (!_explodables.Contains(a_explodable) || !referenceList.Contains(a_explodable)) { Debug.LogWarning(string.Format("(Scene Manager) Attempted remove to reference '{0}' when not already referenced", a_explodable.name)); return; } #endif referenceList.Remove(a_explodable); _explodables.Remove(a_explodable); // Raise player win/loss event if objectives are met switch (a_type) { case ExplodableType.Sheep: if (_player.explosionCount <= 0 && sheepCount > 0 && _generators.Count > 0) { // HACK: Fixes bug where having no explodables with // an explosions left fails player Invoke("NoExplosionsLeftFailure", 1.0f); } else if (sheepCount <= 0) { RaisePlayerWinEvent(PlayerWinState.AllSheepDestroyed); } break; case ExplodableType.NuclearSheep: RaisePlayerLossEvent(PlayerLoseState.DetonatedNukeSheep); break; case ExplodableType.Crate: break; case ExplodableType.Generator: if (generatorsCount <= 0) { RaisePlayerWinEvent(PlayerWinState.AllGeneratersDestroyed); } break; } }
public void AddExplodableReference(ExplodableType a_type, Explodable a_explodable) { List<Explodable> referenceList = GetList(a_type); #if UNITY_EDITOR // Ensure object isn't already referenced if (_explodables.Contains(a_explodable) || referenceList.Contains(a_explodable)) { Debug.LogWarning(string.Format("(Scene Manager) Attempted to reference '{0}' when already referenced", a_explodable.name)); return; } #endif referenceList.Add(a_explodable); _explodables.Add(a_explodable); }