Hark-the-Moon-Men-Cometh / Assets / Scripts / Creatures / Enemy.cs
Enemy.cs
Raw
using System;
using System.Collections;
using UnityEngine;
using UnityEngine.AI;

public abstract class Enemy : Creature, IAttacker
{

    public float m_attackPeriod;
    public float m_attackTimer;

    //these are for stuff that hasn't been implemented yet
    public float m_engagmentRange;
    public bool m_isAttacking;
    public bool m_canAttack;

    //public <?> weapon    

    protected override void Awake()
    {
        base.Awake();
        m_isTakingDamage = false;
        m_isAttacking = false;
        m_canAttack = false;
        m_attackTimer = 0;
    }

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

    public abstract void SetIsAttacking(bool attacking);

    protected abstract void Attack();

    public override void Die()
    {
        Destroy(gameObject);
    }   

    public override void StopTakingDamage()
    {
        base.StopTakingDamage();
    }

    //TODO: this is kinda messy, needs redoing later
    public override void TakeDamage(float damage)
    {
        r_animator.SetTrigger("Take Damage");
        m_isTakingDamage = true;
        m_currentHealth -= damage;
        if (m_currentHealth <= 0)
        {
            r_animator.SetTrigger("Death");
        }
    }    
}