// Do damage and remove all entries of this projectile and flag it for destruction // This is so to maintain a reference of the projectile until the end of the collision detection public void DestroyProjectile(Projectile projectile) { DoDamage(projectile); colliderIdWithProjectiles.Remove(projectile.collider.GetInstanceID()); projectiles.Remove(projectile); flaggedForDestruction.Remove(projectile); Destroy(projectile.gameObject); }
public void DespawnPlayer(byte id) { BasePlayer player = players.GetObjWithId(id); if (player) { players.Remove(player); Destroy(player.gameObject); } }
// Delete the selectors with the id of the peer private void Disconnection(byte id, bool thisPeer) { if (!thisPeer) { PlayerSelector selector = GetSelectorFromID(id); if (selector) { selectorList.Remove(selector); Destroy(selector.gameObject); } // Delete all selectors when this peer is leaving } else { DeleteAllSelectors(); } }
public void DeleteEnemy(BaseEnemy enemy) { enemies.Remove(enemy); Destroy(enemy.gameObject); }