// TRIGGERS ---------------------------------------------------------- private void OnTriggerEnter(Collider other) { if (!other.gameObject.tag.Equals("Creature")) { return; } CreaturesBase creatureBase = other.gameObject.GetComponent <CreaturesBase>(); // Take damage on entry if (creatureBase.size > playerStats.GetSize() && (creatureBase.type.Equals("carnivore") || animator.GetBool("BiteAnim"))) { playerStats.GetDamage(creatureBase.hitPoints); } }
private void OnTriggerStay(Collider other) { if (!other.gameObject.GetComponent <CreaturesBase>()) { return; } CreaturesBase creatureBase = other.gameObject.GetComponent <CreaturesBase>(); if (animator.GetBool("BiteAnim") && ((other.gameObject.tag.Equals("Creature") && (playerStats.GetSize() + playerStats.eatingUpperEdge >= creatureBase.size)) || (isOmnivore && other.gameObject.tag.Equals("Vegitation")))) { if (creatureBase.isAlive) { playerStats.Grow(creatureBase.Harvest()); creatureBase.Die(); } } }