Example #1
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.tag == "Player")
     {
         PlayerHealth1 PHealth = GameObject.Find("player").GetComponent <PlayerHealth1>();
         PHealth.adjustcurrenthealth(20f);
         Destroy(body);
     }
 }
Example #2
0
 private void OnTriggerEnter(Collider other)
 {
     wink = GameObject.Find("WINK").GetComponent <AudioSource>();
     if (other.gameObject.tag == "Player")
     {
         PlayerHealth1 PHealth = GameObject.Find("player").GetComponent <PlayerHealth1>();
         wink.Play();
         PHealth.adjustcurrenthealth(100f);
         Destroy(body);
         GemCanvas.SetActive(true);
     }
 }
 void OnTriggerStay(Collider other)
 {
     if (other.gameObject.tag == "Player")
     {
         anim.SetTrigger("IsAttack");
         if (TimetoAtk < 0f)
         {
             TimetoAtk = 0f;
         }
         if (TimetoAtk == 0f)
         {
             PlayerHealth1 Phealth = GameObject.Find("player").GetComponent <PlayerHealth1>();
             Phealth.adjustcurrenthealth(damage);
             hit.volume = 0.1f;
             hit.Play();
             TimetoAtk = Cooldown;
         }
         if (TimetoAtk > 0f)
         {
             TimetoAtk -= Time.deltaTime;
         }
     }
 }