Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class DroneHealth : MonoBehaviour
- {
- public float Health;
- public bool isDead;
- public DroneManager droneManage;
- GameObject thisGameObj;
- //use for initialization
- public void Start()
- {
- isDead = false;
- thisGameObj = this.gameObject;
- }
- public void Update()
- {
- if(Health <= 0)
- {
- isDead = true;
- //Remove from Drone Manager List
- droneManage.drones.Remove(thisGameObj);
- //Destroy this GameObject
- Destroy(this.gameObject);
- }
- }
- public void Damage(float dmgVal)
- {
- if(isDead == false)
- {
- Health = Health - dmgVal;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement