Dong_Minh_Doxygen: D:/Google Drive/Unity Projects/Tank Game/Assets/Scripts/Bullet.cs Source File

Dong Minh

Dong_Minh_Doxygen
Bullet.cs
Go to the documentation of this file.
1 using UnityEngine;
2 using System.Collections;
3 using System.Collections.Generic;
4 
5 public class Bullet : MonoBehaviour
6 {
28  void OnCollisionEnter(Collision collision)
29  {
30  var hit = collision.gameObject;
31  var health = hit.GetComponent<Health>();
32  if (health != null)
33  {
34  health.TakeDamage(1);
35  }
36 
37  if(GameObject.FindGameObjectWithTag("tankObject"))
38  Destroy(gameObject);
39  }
40 }
Definition: Health.cs:6
void OnCollisionEnter(Collision collision)
When there is a collision detection from the enemy bullet to the player&#39;s tank. If it collides with e...
Definition: Bullet.cs:28
void TakeDamage(int amount)
Whenever the player takes damage, the health will go down.
Definition: Health.cs:61
Definition: Bullet.cs:5
Generated by   doxygen 1.8.13