Advertisement
Guest User

health nuevo

a guest
Sep 23rd, 2019
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.46 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class Health : MonoBehaviour
  6. {
  7.     public float Vida
  8.     {
  9.         get { return vida; }
  10.         set
  11.         {
  12.             vida = value;
  13.             if(vida <= 0)
  14.             {
  15.                 Destroy(gameObject);
  16.             }
  17.  
  18.         }
  19.     }
  20.     public float vida = 100;
  21.  
  22.     public void TakeDamage(float damage)
  23.     {
  24.         Vida -= damage;
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement