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 Heal : MonoBehaviour
- {
- public float startHp;
- public float hp;
- void Start()
- {
- hp = startHp;
- }
- // Update is called once per frame
- public void DealDamage( float damage )
- {
- hp -= damage;
- if (hp <= 0)
- {
- Die();
- }
- }
- void Die()
- {
- if (gameObject.tag == "Player")
- {
- Debug.Log("You died");
- }
- else
- {
- Destroy(gameObject);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement