private void Start() { //We allow this MonoBehvaiour to be placed on a child object. //If it is placed on a MonoBehaviour with a HerbivoreBase component, //GetComponentInParent will still find it. m_Owner = GetComponentInParent <HerbivoreBase>(); if (m_Owner == null) { throw new Exception(name + " does not have a HerbivoreBase component"); } }
public void KillHerbivore(HerbivoreBase herb, bool predation = false) { if (herb == null || herb.gameObject == null) { return; } if (m_Herbivores.ContainsKey(herb.Type)) { m_Herbivores[herb.Type].Remove(herb); } OctreeManager.Get(OctreeType.Herbivore).Remove(herb.transform); if (predation && OnPredationEvent != null) { OnPredationEvent(herb); } NetworkServer.Destroy(herb.gameObject); ValidateHerbivoreCount(); }
public abstract void Eat(HerbivoreBase herbivore);
public override void Eat(HerbivoreBase herbivore) { //Eat WildeBeest Console.WriteLine(this.GetType().Name + " eats " + herbivore.GetType().Name); }
public AnimalWorld(ContinentFactory factory) { _carnivoreBase = factory.CreateCarnivore(); _herbivore = factory.CreateHerbivore(); }