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

public class AttackBox : MonoBehaviour {
    Collider col;
    Animator anim;
	private bool canDamage = true;

    private void Awake()
    {
        col = GetComponent<Collider>();
        anim = GetComponent<Animator>();
    }

    public IEnumerator Attack()
    {
        col.enabled = true;
		canDamage = true;
        anim.SetBool(Animator.StringToHash("attacking"), true);
        yield return new WaitForSeconds(.3f);
        anim.SetBool(Animator.StringToHash("attacking"), false);
        col.enabled = false;
		canDamage = false;
    }

    private void OnTriggerEnter(Collider other)
    {
		if (other.GetComponent<Gorgon> ()) {
			other.GetComponent<Gorgon> ().TakeDamage (25);
			canDamage = false;
		}
    }
}
