コード例 #1
0
 void OnTriggerEnter(Collider col)
 {
     if (col.gameObject == player)
     {
         playerHealth.setHealth(0.0f);
         zombie.Play();
     }
 }
コード例 #2
0
 void OnTriggerEnter(Collider col)
 {
     if (col.gameObject.tag == "Player")
     {
         Instantiate(explosion, transform.position, Quaternion.identity);
         gasFill.enabled = true;
         gasFill.Play();
         explosion.Play();
         playerHealth.setHealth(140.0f);
         Destroy(gameObject);
     }
 }