Newer
Older
TheVengeance-Project-IADE-Unity2D / Assets / Scripts / NPC / Orc / EnemyNPCContoller.cs
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
using MyCollections.AI.FinitStateMachine;

public abstract class EnemyNPCContoller : NPCConroller
{
    [SerializeField] protected State initialState;

    [Header("Other References: ")]
    [SerializeField] protected GameObject healthBar;

    [SerializeField] protected Image healthBarImage;
    public Image HealthBarImage => healthBarImage;

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

    protected virtual void OnEnable()
    {
        health = maxHealth;
        fsm.SetInitialState(initialState);
        NPCManager.Instance.RegisterNPC(this);
        healthBarImage.fillAmount = MaxHealth;
    }

    // Start is called before the first frame update
    protected override void Start()
    {
        base.Start();
        NPCManager.Instance.RegisterNPC(this);
    }

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

    protected virtual void OnDisable()
    {
        NPCManager.Instance.UnregisterNPC(this);
    }

}