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

public class SlpashTextHud : MonoBehaviour
{

    public string splashText;
    public GameObject TextDisplay;

    public static float EnginInteg = RepairableEngin.Integrity;
    public static float GeneratorInteg = RepairableGenerator.Integrity;
    public static float GravityInteg = RepairableGravity.Integrity;
    public static float LifeInteg = RepairableLifeSuport.Integrity;
    public static float ShipIntegrity = RepairAll.ShipIntegrity;

    // Start is called before the first frame update
    void Start()
    {
        splashText = "";
    }

    // Update is called once per frame
    void Update()
    {
        EnginInteg = RepairableEngin.Integrity;
        GeneratorInteg = RepairableGenerator.Integrity;
        GravityInteg = RepairableGravity.Integrity;
        LifeInteg = RepairableLifeSuport.Integrity;
        ShipIntegrity = RepairAll.ShipIntegrity;
        
        GravDamage();
    }

    void GravDamage()
    {
        if (GravityInteg < 10)
        {
            splashText = "Gravity Genorators At Critical! " +
                "Imediate atention needed!";
            TextDisplay.GetComponent<TextMesh>().text = splashText;

        }
        else if (GravityInteg < 50)
        {
            splashText = "Gravity Genorators Failing.";
            TextDisplay.GetComponent<TextMesh>().text = splashText;
        }
        else if (GravityInteg == 50)
        {
            splashText = "";
            TextDisplay.GetComponent<TextMesh>().text = splashText;
        }
    }
}
