Advertisement
Guest User

HitBullet

a guest
Feb 24th, 2020
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.47 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class HitBullet : MonoBehaviour
  6. {
  7.     int health = 100;
  8.  
  9.     // Update is called once per frame
  10.     void Update()
  11.     {
  12.        
  13.     }
  14.  
  15.     void OnTriggerEnter(Collider other)
  16.     {
  17.         Debug.Log("In OnCollisionEnter.");
  18.  
  19.         if(other.gameObject.tag == "Bullet")
  20.         {
  21.             health -= 10;
  22.             Debug.Log("In if statement.");
  23.         }
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement