Example #1
0
 // Eaten by player on collision
 private void OnTriggerEnter(Collider other)
 {
     if (other.tag == "Player")
     {
         huntingMinigame.EatAnimal(other.GetComponent <PlayerController>().fakActive);
         other.GetComponent <PlayerController>().beastAnim.SetTrigger("IsAttacking");
         Destroy(gameObject);
     }
     else if (other.gameObject.tag == "Trap")
     {
         Destroy(other.gameObject);
         // Instantiate(corpse, transform.position, transform.rotation);
         Destroy(gameObject);
     }
 }
Example #2
0
 private void OnCollisionEnter(Collision collision)
 {
     if (collision.gameObject.tag == "Player")
     {
         PlayerController player = collision.gameObject.GetComponent <PlayerController>();
         if (attacking)
         {
             if (player.gameManager.shieldCount > 0)
             {
                 if (!player.shieldDown)
                 {
                     player.gameManager.shieldCount--;
                     player.shieldDown = true;
                 }
             }
             else
             {
                 huntingMinigame.EndMinigame();
             }
         }
         else
         {
             huntingMinigame.EatAnimal(player.fakActive);
             player.beastAnim.SetTrigger("IsAttacking");
             Destroy(gameObject);
         }
     }
     else if (collision.gameObject.tag == "Trap")
     {
         collision.gameObject.GetComponent <Trap>().TrapActivated();
         // Instantiate(corpse, transform.position, transform.rotation);
         Destroy(gameObject);
     }
     else if (collision.gameObject.tag == "Decoy")
     {
         if (attacking)
         {
             Destroy(collision.gameObject);
         }
     }
 }