public void Add(ITileInhabitant newInhabitant) { inhabitants.Add(newInhabitant); foreach (ITileObserver observer in observers) { observer.OnInhabitantEntered(newInhabitant); } }
public bool Remove(ITileInhabitant inhabitant) { bool success = inhabitants.Remove(inhabitant); if (success) { foreach (ITileObserver observer in observers) { observer.OnInhabitantExited(inhabitant); } } return(success); }
private bool CanAttack(ITileInhabitant other) { return(other is IPlayer && !toIgnore.Contains(other)); }