protected IEntity Eat(Point p, HashSet <Type> canEat) { IList <IEntity> entitiesHere = pasture.GetEntitiesAt(p); foreach (var entity in entitiesHere) { if (canEat.Contains(entity.GetType())) { return(entity); } } return(null); }
void eat(Point p) { IList <IEntity> things = pasture.GetEntitiesAt(p); foreach (IEntity i in things) { if ('g'.Equals(i.GetSymbol())) { pasture.RemoveEntity(i); i.kill(); curr_ttl = ttl; return; } } curr_ttl--; }