public void Remove(TSource source, TDestination destination) { if (EqualityComparer <TDestination> .Default.Equals(forward[source], destination)) { throw new ArgumentException("Source doesn't map to destination."); } if (EqualityComparer <TSource> .Default.Equals(reverse[destination], source)) { throw new ArgumentException("Destination doesn't map to source."); } forward.Remove(source); reverse.Remove(destination); }
public void RemoveEntity(Entity entity) { if (entity.Scene != null && entity.Scene != scene) { RemoveEntity(entity); LogEvent.Engine.Warning("Entity was already registered in another scene."); } componentsByEntity.Remove(entity.Id); entities.Remove(entity.Id); OnEntityRemoved(new EntityEventArgs(entity)); }
public void UnregisterPlayer(InputDataHolder playerInfo) { IPlayer player = playerToGuid.Forward[(Guid)playerInfo.identifier]; PlayerConstraints constraints = playerConstraints[player]; playerConstraints.Remove(player); playerToGuid.Remove((Guid)playerInfo.identifier); player.DestroyMe(); Destroy(constraints.MenuPlayer.gameObject); if (GameManager.instance.GetActiveGameScene() == GameScene.Menu) { GameManager.instance.UpdatePlayerCount(playerToGuid.GetKeys().Count); } else if (GameManager.instance.GetActiveGameScene() == GameScene.Game) { CheckRemainingPlayers(); } }