public void RemoveAll() { if (starships != null) { foreach (var ship in starships) { Starship shp = starships[ship.Key]; Destroy(shp.gameObject); if (shp == myStarship) { myStarship = null; } } } if (weaponShots != null) { foreach (var shot in weaponShots) { WeaponShot sht = weaponShots[shot.Key]; if (sht != null) { sht.Destroy(); } } } weaponShots = new Dictionary <int, WeaponShot>(); starships = new Dictionary <int, Starship>(); }
public void removeWeaponShot(int id) { if (!weaponShots.ContainsKey(id)) { return; } WeaponShot shot = weaponShots[id]; // The shot could have already been removed if the explosion was notified by the server before the proximity update if (shot != null) { weaponShots.Remove(id); shot.Destroy(); } }