public void SpawnRandomAnimal() { Animal a; OrderedPair <int> spawnLocation = Utilities.GetRandomPoint(); int x = spawnLocation.X; int y = spawnLocation.Y; AnimalType animalType = UtilityDecider <AnimalType> .WeightedRandomChoice(animalSpawnWeights); switch (animalType) { case AnimalType.Bear: a = Animal.CreateBear(x, y); break; case AnimalType.Wolf: a = Animal.CreateWolf(x, y); break; case AnimalType.Hog: a = Animal.CreateHog(x, y); break; default: a = Animal.CreateGoat(x, y); break; } Console.WriteLine("Spawning a {0}", animalType); EntitiesAdd(a); }
public AnimalBrain() { utilityDecider = new UtilityDecider <Need>(); utilityDecider.AddResponseFunction(Need.Health, x => x); utilityDecider.AddResponseFunction(Need.Hunger, x => x); utilityDecider.AddResponseFunction(Need.Social, x => x); utilityDecider.AddResponseFunction(Need.Lust, x => x); utilityDecider.AddResponseFunction(Need.Tiredness, x => x); utilityDecider.AddResponseFunction(Need.Boredom, x => x); utilityDecider.AddResponseFunction(Need.JobFullfilment, x => x); }
public PersonBrain(int personLimit, int desiredFoodCount, OrderedPair <int> housePosition, RectangleF houseBox) { this.personLimit = personLimit; this.desiredFoodCount = desiredFoodCount; this.housePosition = housePosition; houseRectangle = houseBox; Tasks = new List <Task>(); utilityDecider = new UtilityDecider <Need>(); utilityDecider.AddResponseFunction(Need.Hunger, x => x); utilityDecider.AddResponseFunction(Need.Social, x => x); utilityDecider.AddResponseFunction(Need.Lust, x => x); utilityDecider.AddResponseFunction(Need.Tiredness, x => x); utilityDecider.AddResponseFunction(Need.Boredom, x => x); utilityDecider.AddResponseFunction(Need.JobFullfilment, x => x); dropUtility = new ActionUtility(new DropAction(houseRectangle), new Tuple <Need, double>[] { ActionUtility.NewPair(Need.JobFullfilment, DDeltaConfig.dropFoodDelta) }); }