Exemple #1
0
    public void StartWarning()
    {
        Debug.Log($"TestVAR: {testVar}");
        testVar = "StartWarning";
        Debug.Log($"TestVAR: {testVar}");
        Debug.Log($"Starting Warning for {failureName}");
        if (!HUDWarning)
        {
            Debug.Log("Trying to setup the hud again...");
            //SetupHUDWarning();
        }

        if (!HUDWarning)
        {
            Debug.Log("Unable to start HUD warning, no HUD?");
            if (flightWarning == null)
            {
                Debug.Log("Flight Warning Not Created");
            }
            else
            {
                flightWarnings.AddContinuousWarning(flightWarning);
            }
        }
        else
        {
            HUDWarning.runWarning = true;
            Debug.Log(HUDWarning.warnText.color);
            Debug.Log(HUDWarning.warnText.text);
        }
    }
    public void Update()
    {
        if (runWarning)
        {
            if (!warnCleared)
            {
                if (Time.time - timeWarned > warnInterval)
                {
                    timeWarned = Time.time;
                }
                if (Time.time - this.timeWarned < warnInterval * 0.75f)
                {
                    warnText.enabled = true;
                }
                else
                {
                    warnText.enabled = false;
                }
                if (!wasWarn)
                {
                    flightWarnings.AddContinuousWarning(flightWarning);

                    wasWarn = true;
                    return;
                }
            }
            else
            {
                if (wasWarn)
                {
                    flightWarnings.RemoveContinuousWarning(flightWarning);
                    wasWarn    = false;
                    runWarning = false;
                }
                warnText.enabled = false;
                runWarning       = false;
            }
        }
    }