예제 #1
0
        public Abiotic.Abiotic GetNewAbiotic(Type abioticType)
        {
            var x          = RandomHolder.GetInstance().Random.Next(1, World.XMax);
            var y          = RandomHolder.GetInstance().Random.Next(1, World.XMax);
            var newAbiotic = Activator.CreateInstance(abioticType, x, y);

            return(newAbiotic as Abiotic.Abiotic);
        }
예제 #2
0
        public Plant.Plant GetNewPlant(Type plantType)
        {
            var x      = RandomHolder.GetInstance().Random.Next(1, World.XMax);
            var y      = RandomHolder.GetInstance().Random.Next(1, World.XMax);
            var health = RandomHolder.GetInstance().Random.Next(1, Plant.Plant.MaxHealth);

            var newPlant = Activator.CreateInstance(plantType, x, y, health);

            return(newPlant as Plant.Plant);
        }
예제 #3
0
        public Animal.Animal GetNewAnimal(Type animalType)
        {
            var x               = RandomHolder.GetInstance().Random.Next(1, World.XMax);
            var y               = RandomHolder.GetInstance().Random.Next(1, World.XMax);
            var gender          = (Gender)RandomHolder.GetInstance().Random.Next(0, 1);
            var consumptionType = RandomHolder.GetInstance().Random.Next(0, 1) == 0 ? ConsumptionType.Vegan : ConsumptionType.Predator;
            var newAnimal       = Activator.CreateInstance(animalType, x, y, gender, consumptionType);

            return(newAnimal as Animal.Animal);
        }
예제 #4
0
        public override Intention RequestIntention()
        {
            RandomDelta = RandomHolder.GetInstance().Random.Next(-1, 2);
            while (RandomDelta == 0)
            {
                RandomDelta = RandomHolder.GetInstance().Random.Next(-1, 2);
            }
            var rand = RandomHolder.GetInstance().Random.Next(2);

            if (rand == 0)
            {
                return(new Intention {
                    DeltaX = 0, DeltaY = (RandomDelta * Speed)
                });
            }
            return(new Intention {
                DeltaX = (RandomDelta * Speed), DeltaY = 0
            });
        }
예제 #5
0
 public void SetHealth()
 {
     Health = RandomHolder.GetInstance().Random.Next(1, 10);
 }
예제 #6
0
 public int GetRandomHealth()
 {
     return(RandomHolder.GetInstance().Random.Next(1, 10));
 }
예제 #7
0
 public int GetRandom()
 {
     return(RandomHolder.GetInstance().Random.Next(1, World.XMax));
 }
예제 #8
0
 public void SetGender()
 {
     Gender = RandomHolder.GetInstance().Random.Next(0, 2) == 0 ? Gender.Male : Gender.Female;
 }