using Assets.Scripts.Network;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class Home_health : MonoBehaviour
{
    public static Home_health script;
    private float health = 100;
    public Image homeHealthCircle;
    public Animator sparklesAnimator;
    public Animator homeTextAnimator;


    private void Awake()
    {
        script = this;
    }
    // Start is called before the first frame update
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {
        if (World.currentWorld != null && World.currentWorld.MyHouse != null)
        {
            if ((World.currentWorld.MyHouse.Energy.Level / World.currentWorld.MyHouse.Energy.Capacity * 100) > health)
            {
                //uuseris atnesa kristaalu maajaas
            //    sparklesAnimator.SetTrigger("launch_sparkles");
            //    homeTextAnimator.SetTrigger("flash");

            }
            health = World.currentWorld.MyHouse.Energy.Level / World.currentWorld.MyHouse.Energy.Capacity * 100;
            homeHealthCircle.fillAmount = World.currentWorld.MyHouse.Energy.Level / World.currentWorld.MyHouse.Energy.Capacity;
        }

    }


}
  

