Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class Shootable : MonoBehaviour
- {
- //The box's current health point total
- public int currentHealth = 100;
- public void Damage(int damageAmount)
- {
- //subtract damage amount when Damage function is called
- currentHealth -= damageAmount;
- //Check if health has fallen below zero
- if (currentHealth <= 0)
- {
- //if health has fallen below zero, deactivate it
- gameObject.SetActive(false);
- }
- }
- private void Update()
- {
- Debug.Log(currentHealth);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement