SvOzMaS

PlayerHurt

Dec 13th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.36 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class PlayerHurt : MonoBehaviour {
  5.  
  6.     public int damage;    //Damage the player will receive when enter the trigger
  7.  
  8.     private void OnTriggerEnter(Collider other) {
  9.         if (other.gameObject.CompareTag("Player")) {
  10.             other.GetComponent<PlayerHealth>().hurt(damage);
  11.         }
  12.     }
  13. }
Add Comment
Please, Sign In to add comment