Beispiel #1
0
    // 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);
        }
    }
Beispiel #2
0
    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();
            }
        }
    }