public void AddAnimalTest() { Wagon wagon = new Wagon(new Carnivore(Size.Medium)); Animal animal = new Herbivore(Size.Small); var result = wagon.AddAnimal(animal); Assert.IsFalse(result); }
/// <summary> /// Damages the herbivore if player presses the eat button /// </summary> /// <param name="col"></param> private void Eat(Character col) { if (InputManager.Instance.GetButton("Eat")) { Herbivore vor = col as Herbivore; Debug.Log("mums, mums...."); EatHerbivore(slowDown, vor.Health); vor.GetEaten(damage); } }
public void HerbivoreAlreadyDeadTest() { // Check if IsAlive is set properly, or if it flips var rng = new Random(); var testHerb = new Herbivore(rng); testHerb.IsAlive = false; testHerb.Kill(); Assert.False(testHerb.IsAlive); }
public void Initialize() { testTerrarium = new Terrarium(10, 10); plant = new Plant(); herbivore = new Herbivore(); carnivore = new Carnivore(); human = new Human(); earthquake = new EarthQuake(); time = new TimeController(0, testTerrarium); }
public override string ToString() { Herbivore herbivore = this.CreateHerbivore(); string herbivoreMessage = $"{nameof(Herbivore)}: {herbivore.GetType().Name}"; Carnivore carnivore = this.CreateCarnivore(); string carnivoreMessage = $"{nameof(Carnivore)}: {carnivore.GetType().Name}"; return($"{this.GetType().Name}{Environment.NewLine}{herbivoreMessage}{Environment.NewLine}{carnivoreMessage}"); }
public void EndMatchForPlayer(Herbivore player) { herbivoresWon += 1; player.EnablePlayer(false); player.EnablePlayerCamera(false); if (herbivoresWon == NetworkGameManager.Instance.InGamePlayerList.Count - 1) { EndMatch(); } }
public void Initialize() { testTerrarium = new Terrarium(5, 5); plant = new Plant(); herbivore = new Herbivore(); carnivore = new Carnivore(); human = new Human(); vulcano = new Vulcano(); time = new TimeController(0, testTerrarium); }
public void HerbivoresBreedAndAddNewHerbivore() { toAdd.Clear(); Position herbivore1Position = new Position(1, 1); Position herbivore2Position = new Position(2, 1); Herbivore herbivore1 = new Herbivore(herbivore1Position, BeginTerrarium); Herbivore herbivore2 = new Herbivore(herbivore2Position, BeginTerrarium); herbivore1.Breed(toAdd); Assert.AreEqual(1, toAdd.Count); // test of nieuwe herbivoor is aangemaakt }
public void PlaceAnimalInWagonAdd2LargeHerbivores() { Train train = new Train(); Herbivore Herbivore = new Herbivore(AnimalEnums.AnimalSize.Large); train.PlaceAnimalInWagon(Herbivore); bool actual = train.PlaceAnimalInWagon(Herbivore); Assert.IsTrue(actual); }
public void Test_Third_Animal_Doesnt_Fit_In_Wagon() { Herbivore animal1 = new Herbivore(Weight.Large); Herbivore animal2 = new Herbivore(Weight.Large); Herbivore animal3 = new Herbivore(Weight.Large); Wagon wagon = new Wagon(); wagon.PlaceAnimal(animal1); wagon.PlaceAnimal(animal2); Assert.IsFalse(wagon.CanAnimalBePlaced(animal3)); }
public void HerbivoreFeedingIncreasesFitnessTest() { /*food => Phat*/ var testHerbivore = new Herbivore(new Random(), testCoor); var food = 100; testHerbivore.Params.F = 25; var initialFitness = testHerbivore.Fitness; var remainder = testHerbivore.Feed(food); var endFitness = testHerbivore.Fitness; }
public void HerbivoreFeedWhenLessThanFTest() { Herbivore testHerb = new Herbivore(new Random()); double F = testHerb.Params.F; double available = F - 5.0; double remainder = testHerb.Feed(available); Assert.Equal(0, remainder); }
public void UpdateMatchUI(Character source) { if (source.GetType() == typeof(Herbivore)) { Herbivore h = source.GetComponent <Herbivore>(); HUDController.Instance.MaxHealth = (int)h.Maxhealth; HUDController.Instance.CurProgress = h.Experience; HUDController.Instance.CurHealth = (int)h.Health; } }
public void HerbivoreFeedZeroAvailableTest() { Herbivore testHerb = new Herbivore(new Random()); double initialWeight = testHerb.Weight; double initalAmount = 0.0; double remainder = testHerb.Feed(initalAmount); double endWeight = testHerb.Weight; Assert.Equal(0, remainder); Assert.Equal(initialWeight, endWeight); }
public void GetFoodPrice_When_Invalid_Weight_Throws_Exception() { // Arrange var specie = new Herbivore { Specie = AnimalSpecieNames.Giraffe, Rate = 0.5, PricePerKg = 2 }; // Act, Assert Assert.Throws <ArgumentException>(() => specie.GetFoodPrice(-100)); }
private new void Update() { switch (state) { case State.Nourished: NormalFly(); break; case State.Hungry: if (food == null) { if (!foodOnSight) { SearchFood(); NormalFly(); } } else { Herbivore herbivore = food.GetComponent <Herbivore>(); if (canMove && !herbivore.IsAtTree) { Hunt(herbivore); } else { NormalFly(); } } break; case State.Thirsty: if (water == null) { if (!riverOnSight) { SearchRiver(); } } else { if (canMove) { Flyby(water); } else { NormalFly(); } } break; } }
public void IsFriendsWithTest() { Animal animal = new Herbivore(Size.Medium); var animals = new List <Animal>() { new Carnivore(Size.Large) }; var result = animal.IsFriendsWith(animals); Assert.IsFalse(result); }
public void SpaceAvailableTest() { Wagon wagon = new Wagon(new Carnivore(Size.Medium)); wagon.AddAnimal(new Herbivore(Size.Large)); Animal animal = new Herbivore(Size.Large); var result = wagon.SpaceAvailable(animal); Assert.IsFalse(result); }
public void LegalToAddLargerCarnivoreByHerbivore() { Wagon wagon = new Wagon(); Herbivore herbivore = new Herbivore(AnimalEnums.AnimalSize.Small); Carnivore carnivore = new Carnivore(AnimalEnums.AnimalSize.Medium); wagon.AddToWagon(herbivore); bool actual = wagon.LegalToAdd(carnivore); Assert.IsFalse(actual); }
private void OnCollisionEnter(Collision col) { GameObject gObject = col.gameObject; if (gObject.CompareTag("Herbivore")) { Herbivore herbivore = gObject.GetComponent <Herbivore>(); if (nutritionManager.IsHungry()) { EatFood(herbivore); } } }
public void PlaceAnimalInWagonExceedCapacity() { Train train = new Train(); Herbivore Herbivore = new Herbivore(AnimalEnums.AnimalSize.Large); train.PlaceAnimalInWagon(Herbivore); train.PlaceAnimalInWagon(Herbivore); bool actual = train.PlaceAnimalInWagon(Herbivore); Assert.IsFalse(actual); }
protected override void Hunt(Herbivore preyToHunt) { if (flybyCount == 0) { actualSpeed *= flybySpeedRate; flybyCount++; } if (preyToHunt != null) { SetPrey(preyToHunt); MoveToThis(prey.transform.position); } }
private void OnTriggerEnter(Collider other) { if (other.gameObject.layer == LayerMask.NameToLayer("Herbivore")) { Herbivore p = other.gameObject.GetComponent <Herbivore>(); if (p.Experience == 100) { Debug.Log("Herbivore won!"); InGameManager.Instance.EndMatchForPlayer(p); } } }
public void Animal_Herbivoor1_Wont_Be_eaten() { Herbivore animal = new Herbivore(Weight.Small); List <Animal> animals = new List <Animal>() { new Herbivore(Weight.Small), new Herbivore(Weight.Small), new Herbivore(Weight.Small), new Herbivore(Weight.Small), new Herbivore(Weight.Small) }; Assert.IsTrue(animal.WontBeEaten(animals)); }
public float EatAnimal() { if (grazers.Count == 0) { return(0.0f); } int index = Random.Range(0, grazers.Count); Herbivore meal = grazers[index]; float meat = meal.GetEaten(); grazers.RemoveAt(index); return(meat); }
public void GiveWagonAmountAdd2HerbivoresLarge() { Train train = new Train(); Herbivore Herbivore = new Herbivore(AnimalEnums.AnimalSize.Large); train.PlaceAnimalInWagon(Herbivore); train.PlaceAnimalInWagon(Herbivore); int actual = train.GiveWagonAmount(); int expected = 1; Assert.AreEqual(expected, actual); }
public void HerbivoreLosesWeightTest() { /*Description*/ var rng = new Random(); var testHerb = new Herbivore(rng); var presetWeight = 100; testHerb.Weight = presetWeight; testHerb.UpdateWeight(); var amountToLose = presetWeight * testHerb.Params.Eta; Assert.True(presetWeight > testHerb.Weight); Assert.True(presetWeight - testHerb.Weight == amountToLose); }
public void LegalToAddExceedCapicity() { Wagon wagon = new Wagon(); Herbivore herbivore = new Herbivore(AnimalEnums.AnimalSize.Large); wagon.AddToWagon(herbivore); wagon.AddToWagon(herbivore); bool actual = wagon.LegalToAdd(herbivore); Assert.IsFalse(actual); }
public void FeedingUpdatesFitnessTest() { var rng = new Random(); var testHerb = new Herbivore(rng) { Weight = 5, Age = 50 }; var initialF = testHerb.Fitness; var food = 100.0; testHerb.Feed(food); var endF = testHerb.Fitness; Assert.True(initialF < endF); }
public void CarnivoreEetHerbivore() { Position carnivorePosition = new Position(1, 1); Position herbivorePosition = new Position(1, 2); Herbivore testHerbivore = new Herbivore(herbivorePosition, BeginTerrarium); testHerbivore.Health = 2; carnivore = new Carnivore(carnivorePosition, BeginTerrarium); carnivore.Health = 3; var BeginHealthCarnivore = carnivore.Health; var HealthHerbivore = testHerbivore.Health; carnivore.Eat(testHerbivore, toDelete); Assert.AreEqual(carnivore.Health, BeginHealthCarnivore + HealthHerbivore); }
public override void Eat(Herbivore h) { // Eat Bison Console.WriteLine(this.GetType().Name + " eats " + h.GetType().Name); }
// Methods public override void Eat(Herbivore h) { // Eat bison Console.WriteLine(this + " eats " + h); }
// Methods public override void Eat(Herbivore h) { // eat wildebeest Console.WriteLine(this + " eats " + h); }
// Methods abstract public void Eat(Herbivore h);
public override void Stomp(Herbivore h) { Console.WriteLine(this.GetType().Name + " lightly stomps on " + h.GetType().Name); }
public override void Eat(Herbivore h) { Console.WriteLine(string.Format("{0} eats {1}",this.GetType().Name,h.GetType().Name)); }
// Constructor public AnimalWorld(ContinentFactory factory) { _carnivore = factory.CreateCarnivore(); _herbivore = factory.CreateHerbivore(); }
public override void Eat(Herbivore herbivore) { Console.WriteLine(GetType().Name + " eats " + herbivore.GetType().Name); }
public string Eats(Herbivore herbivore) { return $"{GetType().Name} eats {herbivore.GetType().Name}"; }
public override void Eat(Herbivore h) { // Eat Wildebeest Console.WriteLine(GetType().Name + " eats " + h.GetType().Name); }
// Constructor public AnimalWorld(ContinentFactory factory) { _carnivore = factory.CreateCarnivore(); _herbivore = factory.CreateHerbivore(); _problem = factory.CreateProblem(); _giant = factory.CreateGiant(); _giant2 = factory.CreateSmallGiant(); }
public abstract void Eat(Herbivore h);
public abstract void Stomp(Herbivore h);