using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Target : MonoBehaviour {
    public float health = 100f;
    protected bool dead = false;

    public float Health {
        get => health;
        set => health = value;
    }

    public void takeDamage(float amout,Transform from) {
        health -= amout;
        if (health <= 0f && !dead) {
            die(from);
            dead = true;
        }
    }

    protected virtual void die(Transform from) {
        Destroy(gameObject);
    }
}
