Example #1
0
    public void UpdateNanitesformation()
    {
        // Get the ship generation and generation potential
        int shipNanites          = CGameShips.Ship.GetComponent <CShipNaniteSystem>().ShipCurentNanites;
        int shipNanitesPotential = CGameShips.Ship.GetComponent <CShipNaniteSystem>().ShipNanitesPotential;

        // Calculate the value ratio
        float value = (float)shipNanites / (float)shipNanitesPotential;

        if (float.IsNaN(value))
        {
            value = 0.0f;
        }

        // Update the bar
        CDUIUtilites.LerpBarColor(value, m_NanitesBar);
        m_NanitesBar.value = value;

        // Update the lable
        m_NanitesRate.color = CDUIUtilites.LerpColor(value);
        m_NanitesRate.text  = shipNanites + " / " + shipNanitesPotential;

        // Update the positive/negative report
        if (value < m_LastNanitesValue)
        {
            m_NanitesNegative.enabled = true;
            m_NanitesPositive.enabled = false;
            m_NanitesIdle.enabled     = false;
        }
        else if (value > m_LastNanitesValue)
        {
            m_NanitesNegative.enabled = false;
            m_NanitesPositive.enabled = true;
            m_NanitesIdle.enabled     = false;
        }
        else
        {
            m_NanitesNegative.enabled = false;
            m_NanitesPositive.enabled = false;
            m_NanitesIdle.enabled     = true;
            m_NanitesIdle.color       = CDUIUtilites.LerpColor(value);
        }

        m_LastNanitesValue = value;
    }
Example #2
0
    public void UpdatePropulsionformation()
    {
        // Get the ship generation and generation potential
        float shipGeneration          = CGameShips.Ship.GetComponent <CShipPropulsionSystem>().ShipCurentPropulsion;
        float shipGenerationPotential = CGameShips.Ship.GetComponent <CShipPropulsionSystem>().ShipPropulsionPotential;

        // Calculate the value ratio
        float value = shipGeneration / shipGenerationPotential;

        if (float.IsNaN(value))
        {
            value = 0.0f;
        }

        // Update the bar
        CDUIUtilites.LerpBarColor(value, m_PropulsionBar);
        m_PropulsionBar.value = value;

        // Update the lable
        m_PropulsionRate.color = CDUIUtilites.LerpColor(value);
        m_PropulsionRate.text  = Mathf.RoundToInt(shipGeneration) + " / " + Mathf.RoundToInt(shipGenerationPotential);

        // Update the positive/negative report
        if (value < m_LastPropulsionValue)
        {
            m_PropulsionNegative.enabled = true;
            m_PropulsionPositive.enabled = false;
            m_PropulsionIdle.enabled     = false;
        }
        else if (value > m_LastPropulsionValue)
        {
            m_PropulsionNegative.enabled = false;
            m_PropulsionPositive.enabled = true;
            m_PropulsionIdle.enabled     = false;
        }
        else
        {
            m_PropulsionNegative.enabled = false;
            m_PropulsionPositive.enabled = false;
            m_PropulsionIdle.enabled     = true;
            m_PropulsionIdle.color       = CDUIUtilites.LerpColor(value);
        }

        m_LastPropulsionValue = value;
    }
Example #3
0
    public void UpdateChargeInformation()
    {
        // Get the ship charge, charge capacity and charge capacity potential
        float shipCharge         = CGameShips.Ship.GetComponent <CShipPowerSystem>().ShipCurrentCharge;
        float shipChargeCapacity = CGameShips.Ship.GetComponent <CShipPowerSystem>().ShipCurrentChargeCapacity;

        // Calculate the value ratio
        float value = shipCharge / shipChargeCapacity;

        if (float.IsNaN(value))
        {
            value = 0.0f;
        }

        // Update the bar
        CDUIUtilites.LerpBarColor(value, m_ChargeBar);
        m_ChargeBar.value = value;

        // Update the lable
        m_ChargeRate.color = CDUIUtilites.LerpColor(value);
        m_ChargeRate.text  = Mathf.RoundToInt(shipCharge) + " / " + Mathf.RoundToInt(shipChargeCapacity);

        // Update the positive/negative report
        if (value < m_LastChargeValue)
        {
            m_ChargeNegative.enabled = true;
            m_ChargePositive.enabled = false;
            m_ChargeIdle.enabled     = false;
        }
        else if (value > m_LastChargeValue)
        {
            m_ChargeNegative.enabled = false;
            m_ChargePositive.enabled = true;
            m_ChargeIdle.enabled     = false;
        }
        else
        {
            m_ChargeNegative.enabled = false;
            m_ChargePositive.enabled = false;
            m_ChargeIdle.enabled     = true;
            m_ChargeIdle.color       = CDUIUtilites.LerpColor(value);
        }

        m_LastChargeValue = value;
    }
Example #4
0
    private void UpdateCapacitorVariables()
    {
        // Get the current charge, intial capacity and current capacity
        float currentCharge   = m_CachedPowerStorageBehaviour.BatteryCharge;
        float currentCapacity = m_CachedPowerStorageBehaviour.BatteryCapacity;
        float initialCapacity = m_CachedPowerCapacitor.m_MaxPowerBatteryCapacity;

        // Update the charge value
        m_CapacityBar.value = currentCharge / currentCapacity;

        // Update the bar colors
        float value = currentCapacity / initialCapacity;

        CDUIUtilites.LerpBarColor(value, m_CapacityBar);

        // Update the label
        m_Charge.text = currentCharge.ToString() + " / " + currentCapacity.ToString();
    }
Example #5
0
    private void UpdateCapacitorVariables()
    {
        // Get the current charge, intial capacity and current capacity
        float currentNanites  = m_CachedNaniteStorageBehaviour.StoredNanites;
        float currentCapacity = m_CachedNaniteStorageBehaviour.NaniteCapacity;
        float initialCapacity = m_CachedNaniteCapsule.m_MaxNaniteCapacity;

        // Update the charge value
        m_CapacityBar.value = currentNanites / currentCapacity;

        // Update the bar colors
        float value = currentCapacity / initialCapacity;

        CDUIUtilites.LerpBarColor(value, m_CapacityBar);

        // Update the label
        m_Nanites.text = currentNanites.ToString() + " / " + currentCapacity.ToString();
    }
Example #6
0
    public void UpdatePropulsionVariables()
    {
        // Get the current generation current generation potential and detirmine the value
        float currentPropulsionRate      = m_CachedPropulsionBehaviour.PropulsionForce;
        float currentPropulsionPotential = m_CachedPropulsionBehaviour.PropulsionPotential;
        float value = currentPropulsionRate / currentPropulsionPotential;

        // Update the generation value and bar color
        m_PropulsionBar.value = value;
        CDUIUtilites.LerpBarColor(value, m_PropulsionBar);

        // Update the lable
        m_PropulsionRate.color = CDUIUtilites.LerpColor(value);
        m_PropulsionRate.text  = currentPropulsionRate.ToString() + " / " + currentPropulsionPotential.ToString();

        // Update the status report
        if (value <= 0.95f && value > 0.5f)
        {
            m_WarningReport.enabled = true;
            m_WarningReport.color   = Color.yellow;
            m_WarningReport.text    = "Warning: Mechanical maintenace required!";
        }
        else if (value <= 0.5f && value > 0.0f)
        {
            m_WarningReport.enabled = true;
            m_WarningReport.color   = Color.red;
            m_WarningReport.text    = "Warning: Mechanical maintenace required!";
        }
        else if (value == 0.0f)
        {
            m_WarningReport.enabled = true;
            m_WarningReport.color   = Color.red;
            m_WarningReport.text    = "Warning: Mechanical component defective!";
        }
        else
        {
            m_WarningReport.enabled = false;
        }
    }
    private void UpdateGeneratorVariables()
    {
        // Get the current generation current generation potential and detirmine the value
        float currentGenerationRate          = m_CachedAtmosphereGeneratorBehaviour.AtmosphereGenerationRate;
        float currentGenerationRatePotential = m_CachedAtmosphereGenerator.m_MaxAtmosphereGenerationRate;
        float value = currentGenerationRate / currentGenerationRatePotential;

        // Update the generation value and bar color
        m_GenerationBar.value = value;
        CDUIUtilites.LerpBarColor(value, m_GenerationBar);

        // Update the lable
        m_GenerationRate.color = CDUIUtilites.LerpColor(value);
        m_GenerationRate.text  = currentGenerationRate.ToString() + " / " + currentGenerationRatePotential.ToString();

        // Update the status report
        if (value <= 0.95f && value > 0.5f)
        {
            m_WarningReport.enabled = true;
            m_WarningReport.color   = Color.yellow;
            m_WarningReport.text    = "Warning: Fluid maintenace required!";
        }
        else if (value <= 0.5f && value > 0.0f)
        {
            m_WarningReport.enabled = true;
            m_WarningReport.color   = Color.red;
            m_WarningReport.text    = "Warning: Fluid maintenace required!";
        }
        else if (value == 0.0f)
        {
            m_WarningReport.enabled = true;
            m_WarningReport.color   = Color.red;
            m_WarningReport.text    = "Warning: Fluid component defective!";
        }
        else
        {
            m_WarningReport.enabled = false;
        }
    }
Example #8
0
    private void UpdateUI()
    {
        // Get the player oxygen supplu
        float oxygenSupply   = CGamePlayers.SelfActor.GetComponent <CPlayerSuit>().OxygenSupply;
        float oxygenCapacity = CGamePlayers.SelfActor.GetComponent <CPlayerSuit>().OxygenCapacity;

        // Calculate the value ratio
        float value = oxygenSupply / oxygenCapacity;

        // Update the bar
        CDUIUtilites.LerpBarColor(value, m_02Bar);
        m_02Bar.value = value;

        // Update the label
        m_O2Value.color = CDUIUtilites.LerpColor(value);
        m_O2Value.text  = Mathf.RoundToInt(oxygenSupply) + " / " + Mathf.RoundToInt(oxygenCapacity);

        // Update the status label
        if (value == 0.0f)
        {
            m_Status.color = Color.red;
            m_Status.text  = "CRITICAL:\nOXYGEN DEPLETED!";

            m_Status.GetComponent <UITweener>().enabled = true;
        }
        else if (value < 0.20f)
        {
            m_Status.color = Color.red;
            m_Status.text  = "Critical:\nLow Oxygen!";

            m_Status.GetComponent <UITweener>().enabled = true;
        }
        else if (value < 0.50f)
        {
            m_Status.color = Color.yellow;
            m_Status.text  = "Warning:\nLow Oxygen!";

            if (m_Status.GetComponent <UITweener>().enabled)
            {
                m_Status.GetComponent <UITweener>().ResetToBeginning();
                m_Status.GetComponent <UITweener>().enabled = false;
            }
        }
        else
        {
            m_Status.text = "";

            if (m_Status.GetComponent <UITweener>().enabled)
            {
                m_Status.GetComponent <UITweener>().ResetToBeginning();
                m_Status.GetComponent <UITweener>().enabled = false;
            }
        }

        // Turn on and update the indicator
        if (CGamePlayers.SelfActor.GetComponent <CActorLocator>().LastEnteredFacility == null && m_VisorUIActive)
        {
            if (!m_ShipIndicator.gameObject.activeSelf)
            {
                m_ShipIndicator.gameObject.SetActive(true);
            }

            m_ShipIndicator.Tracker    = CGameShips.GalaxyShip.transform;
            m_ShipIndicator.GameCamera = CGameCameras.PlayersHeadCamera.camera;
        }
        else
        {
            // Turn off ship indicator
            if (m_ShipIndicator.gameObject.activeSelf)
            {
                m_ShipIndicator.gameObject.SetActive(false);
            }
        }
    }