Пример #1
0
    //******************************************************************************************************************************
    //
    //      VARIABLES
    //
    //******************************************************************************************************************************

    //******************************************************************************************************************************
    //
    //      FUNCTIONS
    //
    //******************************************************************************************************************************

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    //  Called each frame.
    /// </summary>
    private void Update()
    {
        // Update core health
        if (CoreObject != null && SliderBareCoreHealth != null)
        {
            float val = CoreObject.GetHealth();
            SliderBareCoreHealth.value = val;
        }

        // Update core shield
        if (CoreObject != null && SliderBareCoreShield != null)
        {
            float val = CoreObject.GetShield();
            SliderBareCoreShield.value = val;
        }

        // Update spireA health
        if (SpireA != null && SliderBareSpireAHealth != null)
        {
            float val = SpireA.GetHealth();
            SliderBareSpireAHealth.value = val;
        }

        // Update spireB health
        if (SpireB != null && SliderBareSpireBHealth != null)
        {
            float val = SpireB.GetHealth();
            SliderBareSpireBHealth.value = val;
        }

        // Update spireC health
        if (SpireC != null && SliderBareSpireCHealth != null)
        {
            float val = SpireC.GetHealth();
            SliderBareSpireCHealth.value = val;
        }
    }
Пример #2
0
    //******************************************************************************************************************************
    //
    //      FUNCTIONS
    //
    //******************************************************************************************************************************

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    //  Called each frame.
    /// </summary>
    private void Update()
    {
        // Update core health
        if (CoreObject != null && SliderBareCoreHealth != null)
        {
            float val = CoreObject.GetHealth();
            SliderBareCoreHealth.value = val;
        }

        // Update core shield
        if (CoreObject != null && SliderBareCoreShield != null)
        {
            float val = CoreObject.GetShield();
            SliderBareCoreShield.value = val;
        }

        // Update spireA health
        if (SpireA != null && SliderBareSpireAHealth != null)
        {
            float val = SpireA.GetHealth();
            SliderBareSpireAHealth.value = val;
        }

        // Update spireB health
        if (SpireB != null && SliderBareSpireBHealth != null)
        {
            float val = SpireB.GetHealth();
            SliderBareSpireBHealth.value = val;
        }

        // Update spireC health
        if (SpireC != null && SliderBareSpireCHealth != null)
        {
            float val = SpireC.GetHealth();
            SliderBareSpireCHealth.value = val;
        }

        if (_Flashing)
        {
            // Lerp between Colour A & B
            _CurrentFlashColour = Color.Lerp(FlashStartingColour, FlashEndColour, (Mathf.Sin(Time.time * FlashingTextSpeed) + 1) / 2f);

            // Set the text component(s) colour
            if (_Core)
            {
                Text_Core.color = _CurrentFlashColour;
                _TimerCore     += Time.deltaTime;
                if (_TimerCore >= FlashDuration)
                {
                    _Core      = false;
                    _TimerCore = 0f;
                }
            }
            if (_SpireA)
            {
                Text_SpireA.color = _CurrentFlashColour;
                _TimerSpireA     += Time.deltaTime;
                if (_TimerSpireA >= FlashDuration)
                {
                    _Core        = false;
                    _TimerSpireA = 0f;
                }
            }
            if (_SpireB)
            {
                Text_SpireA.color = _CurrentFlashColour;
                _TimerSpireB     += Time.deltaTime;
                if (_TimerSpireB >= FlashDuration)
                {
                    _Core        = false;
                    _TimerSpireB = 0f;
                }
            }
            if (_SpireC)
            {
                Text_SpireC.color = _CurrentFlashColour;
                _TimerSpireC     += Time.deltaTime;
                if (_TimerSpireC >= FlashDuration)
                {
                    _Core        = false;
                    _TimerSpireC = 0f;
                }
            }
        }
    }