public Animals(animalType type, double health, double attackDamage, Point3D position) { _position = position; _type = type.ToString(); _health = health; _attackDamage = attackDamage; }
//constructor; public Tiger(animalType type, double health, double attackDamage, Point3D position, double strength) : base(type, health, attackDamage, position) { _strength = strength; Health *= Strength; AttackDamage *= (Strength / 2); }
public void CreateAnimal_expectedSameAnimalType(animalType typeInput, animalType expected) { //Arrange //Act animalType typeActual = AnimalFactory.Instance().CreateAnimal(typeInput).type; //Assert Assert.AreEqual(expected, typeActual); }
public void AnimalsMate(animalType type) { if (type == animalType.lion) { NewAnimal(animalType.lion); IncidentsList.Insert(0, "A new Lion was born"); } else if (type == animalType.rabbit) { Random r = new Random(); int temp = r.Next(1, 3); for (int k = 0; k < temp; k++) { NewAnimal(animalType.rabbit); } IncidentsList.Insert(0, $"{temp} new rabbits was born"); } }
public Animal(int weight, int range, animalType type, int weightGain) { this.weight = weight; this.range = range; this.weightGain = weightGain; this.type = type; alive = true; locationX = random.Next(0, Settings.Instance().NumbersOfAreas); locationY = random.Next(0, Settings.Instance().NumbersOfAreas); if (random.Next(1, 3) == 1) { this.gender = gender.male; } else { gender = gender.female; } }
public Animal CreateAnimal(animalType type) { Random r = new Random(); switch (type) { case animalType.lion: return(new Lion( r.Next(Settings.Instance().lionMinWeight + 7, Settings.Instance().lionMaxBornWeight), Settings.Instance().lionRange, Settings.Instance().lionWeightGain)); case animalType.rabbit: return(new Rabbit( r.Next(Settings.Instance().rabbitMinWeight + 2, Settings.Instance().rabbitMaxBornWeight), Settings.Instance().rabbitRange, Settings.Instance().rabbitWeightGain)); default: return(null); } }
public void NewAnimal(animalType animalType) { animalList.Add(AnimalFactory.Instance().CreateAnimal(animalType)); }
private void OnTriggerEnter(Collider other) { bool flag = this.rabbitTrap || this.fishTrap; if ((other.gameObject.CompareTag("Player") || other.gameObject.CompareTag("enemyCollide")) && !flag && !this.sprung) { if (other.gameObject.CompareTag("enemyCollide")) { mutantHitReceiver component = other.transform.GetComponent <mutantHitReceiver>(); netId component2 = other.transform.GetComponent <netId>(); if (component && component.inNooseTrap) { return; } if (component2) { return; } Animator componentInChildren = other.transform.root.GetComponentInChildren <Animator>(); if (componentInChildren) { if (!componentInChildren.enabled) { return; } if (componentInChildren.GetBool("deathfinalBOOL")) { return; } if (componentInChildren.GetBool("sleepBOOL")) { return; } } } if (this.MpClientCheck) { if (other.gameObject.CompareTag("Player")) { TriggerLargeTrap triggerLargeTrap = global::TriggerLargeTrap.Create(GlobalTargets.OnlyServer); triggerLargeTrap.Player = LocalPlayer.Entity; triggerLargeTrap.Trap = this.entity; triggerLargeTrap.Send(); this.TriggerLargeTrap(null); } } else { if (this.MpHostCheck && this.entity && this.entity.isAttached && this.entity.StateIs <ITrapLargeState>()) { this.entity.GetState <ITrapLargeState>().Sprung = true; } this.TriggerLargeTrap(other); } } if (this.MpClientCheck) { return; } if ((this.rabbitTrap && (other.gameObject.CompareTag("animalCollide") || other.gameObject.CompareTag("enemyCollide"))) || (this.fishTrap && other.gameObject.CompareTag("Fish"))) { bool flag2 = false; if (flag && !base.transform.parent.gameObject.CompareTag("trapSprung")) { this.trappedGo = other.gameObject; other.gameObject.SendMessageUpwards("setTrapped", base.gameObject, SendMessageOptions.DontRequireReceiver); base.transform.parent.gameObject.tag = "trapSprung"; this.TriggerRabbitTrap(); if (this.MpHostCheck && this.entity && this.entity.isAttached && this.entity.StateIs <ITrapRabbitState>()) { this.entity.GetState <ITrapRabbitState>().Sprung = true; } } animalType component3 = other.GetComponent <animalType>(); if (component3 && component3.deer && this.largeDeadfall) { if (this.hitbox) { this.hitbox.SetActive(true); } this.CheckAnimReference(); this.anim.GetComponent <Animation>().Play("trapFall"); flag2 = true; base.Invoke("enableTrapReset", 3f); } if (flag2) { this.PlayTriggerSFX(); } } }
public Animal(animalType t, animalSize s) { AnimalSize = s; AnimalType = t; }
public void NewAnimal(animalType animalType) { savannah.NewAnimal(animalType); }