Ejemplo n.º 1
0
 public void Add(ITileInhabitant newInhabitant)
 {
     inhabitants.Add(newInhabitant);
     foreach (ITileObserver observer in observers)
     {
         observer.OnInhabitantEntered(newInhabitant);
     }
 }
Ejemplo n.º 2
0
    public bool Remove(ITileInhabitant inhabitant)
    {
        bool success = inhabitants.Remove(inhabitant);

        if (success)
        {
            foreach (ITileObserver observer in observers)
            {
                observer.OnInhabitantExited(inhabitant);
            }
        }

        return(success);
    }
Ejemplo n.º 3
0
 private bool CanAttack(ITileInhabitant other)
 {
     return(other is IPlayer && !toIgnore.Contains(other));
 }