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

public class HeadFXScript : MonoBehaviour {

    public GameObject m_FxSleep;
    public GameObject m_FxSweat;

    int hp = 8;
    // Use this for initialization
    void Start()
    {
        hp = 8;
        GlobalEvents.OnHPLossEvent += HandleHPLoss;
    }

    void OnDestroy()
    {
        GlobalEvents.OnHPLossEvent -= HandleHPLoss;
    }

    void HandleHPLoss()
    {
        hp--;
        if (hp < 7)
        {
            m_FxSweat.gameObject.SetActive(true);
        }
        if (hp == 0)
        {
            m_FxSweat.gameObject.SetActive(false);
            m_FxSleep.gameObject.SetActive(false);
        }
    }
}
