Advertisement
Tarodev

[SerializeField] 1

Jan 29th, 2020
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.30 KB | None | 0 0
  1. public class Hero : MonoBehaviour {
  2.     public float Health; // This will now be visible in the inspector
  3.  
  4.     public void TakeDamage(float dmg) {
  5.         Health -= dmg;
  6.         if(Health <= 0) Die();
  7.     }
  8.  
  9.     private void Die() {
  10.         // Make gurgling noises and die dramatically
  11.     }
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement