Beispiel #1
0
 private void OnCollisionEnter(Collision collision)
 {
     if (collision.gameObject.tag == "Player1Bullet")
     {
         collision.gameObject.SetActive(false);
         GameObject       player = GameObject.FindWithTag("Player1");
         Player1CarWeapon script = player.GetComponent <Player1CarWeapon>();
         currentHealth    = currentHealth - script.damage;
         healthFill.value = currentHealth / maxHealth;
     }
 }
Beispiel #2
0
 void Pickup(Collider player)
 {
     if (player.tag == "Player1")
     {
         Player1CarWeapon script = player.GetComponent <Player1CarWeapon>();
         script.damage *= 2;
         Destroy(gameObject);
     }
     else
     {
         Player2CarWeapon script = player.GetComponent <Player2CarWeapon>();
         script.damage *= 2;
         Destroy(gameObject);
     }
 }