using UnityEngine;
using System.Collections;

public class hearth : MonoBehaviour {

    public hearthitem hearth1;
    public hearthitem hearth2;
    public hearthitem hearth3;

    public AcceptState acptSt;
    public float attackTimer;
    public bool die = false;
	// Update is called once per frame
	void Update () {
        if (acptSt.damage == true)
        {
            if (!hearth1.turnblue && (attackTimer > 0.2f))
            {
                hearth1.turnblue = true;
                attackTimer = 0;
            }
            else if (!hearth2.turnblue && (attackTimer > 0.2f))
            {
                hearth2.turnblue = true;
                attackTimer = 0;
            }
            else if (!hearth3.turnblue&& (attackTimer > 0.2f))
            {
                hearth3.turnblue = true;
                attackTimer = 0;
                die = true;
            }
        }

        if (acptSt.damage){
            attackTimer += Time.deltaTime;
        }

	}
}


