//-------------------------------------------------------------------------------- protected A FindClosest <A>() where A : Animal { List <A> allA = theZoo.GetAnimalsOfType <A>().Where <A>(z => z != this).ToList <A>(); allA.Sort(CompareByDistance <A>); if (allA.Count() > 0) { return(allA[0]); } else { return(null); } }
private static void RenderAnimals(SCREEN_ELEMENT[,] screen, Zoo theZoo) { foreach (Animal animal in theZoo.GetAnimalsOfType <Animal>()) { screen[animal.locY, animal.locX].foreground = animal.foreground; screen[animal.locY, animal.locX].background = animal.background; screen[animal.locY, animal.locX].value = animal.symbol; } }