// Update is called once per frame
        void Update()
        {
            if (isEnabled)
            {
                switch (VariableType)
                {
                case GlobalVariable.CVariableType.intVar:
                    TargetSlider.value = IntVariables.GetCurrentValue();
                    break;

                case GlobalVariable.CVariableType.floatVar:
                    TargetSlider.value = Mathf.RoundToInt(TimeVariables.GetCurrentValue() / TimeVariables.MaxValue * 100);
                    break;

                case GlobalVariable.CVariableType.healthVar:
                    TargetSlider.value = Mathf.RoundToInt(HealthVariables.GetCurrentValue() / HealthVariables.GetMaxValue() * 100);
                    break;

                case GlobalVariable.CVariableType.manaVar:
                    TargetSlider.value = Mathf.RoundToInt(ManaVariables.GetCurrentValue() / ManaVariables.GetMaxValue() * 100);
                    break;

                case GlobalVariable.CVariableType.expVar:
                    TargetSlider.value = Mathf.RoundToInt(ExpVariables.GetCurrentValue() / ExpVariables.GetMaxValue() * 100);
                    break;

                case GlobalVariable.CVariableType.scoreVar:
                    TargetSlider.value = Mathf.RoundToInt(ScoreVariables.GetCurrentValue());
                    break;

                case GlobalVariable.CVariableType.timeVar:
                    TargetSlider.value = Mathf.RoundToInt(TimeVariables.GetCurrentValue());
                    break;
                }
                if (TargetSlider.value <= 0)
                {
                    TargetSlider.transform.GetChild(1).gameObject.SetActive(false);
                }
                else
                {
                    TargetSlider.transform.GetChild(1).gameObject.SetActive(true);
                }

                if (usingAutoRotation)
                {
                    TargetCanvas.transform.LookAt(TargetCamera.transform);
                }
            }
        }
Beispiel #2
0
 // Update is called once per frame
 void Update()
 {
     if (isEnabled)
     {
         if (usingDebug)
         {
             if (VariableType == GlobalVariable.CVariableType.timeVar)
             {
                 DebugText = TimeVariables.CurrentValue.ToString();
             }
             if (VariableType == GlobalVariable.CVariableType.healthVar)
             {
                 DebugText = HealthVariables.CurrentValue.ToString();
             }
             if (VariableType == GlobalVariable.CVariableType.manaVar)
             {
                 DebugText = ManaVariables.CurrentValue.ToString();
             }
             if (VariableType == GlobalVariable.CVariableType.scoreVar)
             {
                 DebugText = ScoreVariables.CurrentValue.ToString();
             }
             if (VariableType == GlobalVariable.CVariableType.intVar)
             {
                 DebugText = IntVariables.CurrentValue.ToString();
             }
             if (VariableType == GlobalVariable.CVariableType.floatVar)
             {
                 DebugText = FloatVariables.CurrentValue.ToString();
             }
             if (VariableType == GlobalVariable.CVariableType.stringVar)
             {
                 DebugText = StringVariables.CurrentValue.ToString();
             }
             if (VariableType == GlobalVariable.CVariableType.boolVar)
             {
                 DebugText = BoolVariables.CurrentValue.ToString();
             }
         }
         if (VariableType == GlobalVariable.CVariableType.timeVar)
         {
             TargetText.text = PrefixText + TimeVariables.CurrentValue.ToString() + PostfixText;
         }
         if (VariableType == GlobalVariable.CVariableType.healthVar)
         {
             TargetText.text = PrefixText + HealthVariables.CurrentValue.ToString() + PostfixText;
         }
         if (VariableType == GlobalVariable.CVariableType.manaVar)
         {
             TargetText.text = PrefixText + ManaVariables.CurrentValue.ToString() + PostfixText;
         }
         if (VariableType == GlobalVariable.CVariableType.scoreVar)
         {
             TargetText.text = PrefixText + ScoreVariables.CurrentValue.ToString() + PostfixText;
         }
         if (VariableType == GlobalVariable.CVariableType.intVar)
         {
             TargetText.text = PrefixText + IntVariables.CurrentValue.ToString() + PostfixText;
         }
         if (VariableType == GlobalVariable.CVariableType.floatVar)
         {
             TargetText.text = PrefixText + FloatVariables.CurrentValue.ToString() + PostfixText;
         }
         if (VariableType == GlobalVariable.CVariableType.stringVar)
         {
             TargetText.text = PrefixText + StringVariables.CurrentValue.ToString() + PostfixText;
         }
         if (VariableType == GlobalVariable.CVariableType.boolVar)
         {
             TargetText.text = PrefixText + BoolVariables.CurrentValue.ToString() + PostfixText;
         }
         if (usingTimeFormat)
         {
             if (VariableType == GlobalVariable.CVariableType.timeVar)
             {
                 if (TimeFormat == CTimeFormat.None)
                 {
                     TargetText.text = PrefixText + FloatToTime(TimeVariables.GetCurrentValue(), "None") + PostfixText;
                 }
                 if (TimeFormat == CTimeFormat.SS)
                 {
                     TargetText.text = PrefixText + FloatToTime(TimeVariables.GetCurrentValue(), "SS") + PostfixText;
                 }
                 if (TimeFormat == CTimeFormat.MMSS)
                 {
                     TargetText.text = PrefixText + FloatToTime(TimeVariables.GetCurrentValue(), "MMSS") + PostfixText;
                 }
                 if (TimeFormat == CTimeFormat.HHMMSS)
                 {
                     TargetText.text = PrefixText + FloatToTime(TimeVariables.GetCurrentValue(), "HHMMSS") + PostfixText;
                 }
             }
         }
     }
 }