Exemple #1
0
 void OnTriggerEnter2D(Collider2D col)
 {
     if (col.tag == "Player")
     {
         PlayerInv_Script pi = col.GetComponent <PlayerInv_Script>();
         if (pi.BloodAmount < pi.MaxBloodAmount)
         {
             pi.GainBlood(BloodValue);
             Destroy(this.gameObject);
         }
     }
 }
 void OnTriggerEnter2D(Collider2D col)
 {
     if (col.tag == "Enemy" && _playerInput._doDamage)
     {
         col.GetComponent <Enemey_Script>().Death();
         Destroy(col.gameObject);
         _playerInv.GainBlood(BloodGain);
         float r = Random.Range(0.9f, 1.4f);
         _audioSource.pitch = r;
         _audioSource.PlayOneShot(_playerInv.AudioClips[2]);
     }
 }