Newer
Older
TheVengeance-Project-IADE-Unity2D / Assets / Scripts / NPC / Orc / EnemyNPCContoller.cs
@Rackday Rackday on 27 Aug 917 bytes Minor Update
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public abstract class EnemyNPCContoller : NPCConroller, IHealthSystem
{
    [Header("NPC Attributes: ")]
    [SerializeField] protected float health;
    [SerializeField] protected float maxHealth;

    [SerializeField] protected GameObject target;

    public GameObject Target => target;
    public float GetHealth() => health;

    public void Heal(float ammount) => health += ammount;

    public bool IsDead() => health <= 0f;

    public void TakeDamage(float ammount) => maxHealth -= ammount;

    protected override void Awake()
    {
        base.Awake();
    }

    // Start is called before the first frame update
    protected override void Start()
    {
        base.Start();
        health = maxHealth;
    }

    // Update is called once per frame
    protected override void Update()
    {
        base.Update();
    }
}