Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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)
            });
        }