コード例 #1
0
    private void UpdateIcons()
    {
        float num = this.m_BlinkScaleMin + this.m_BlinkingCurve.Evaluate(this.m_BeginTime) * (this.m_BlinkScaleMax - this.m_BlinkScaleMin);

        this.m_BeginTime += 1f / this.m_BlinkingTime * Time.deltaTime;
        if (this.m_BeginTime >= 1f)
        {
            this.m_BeginTime = 0f;
        }
        Vector3 one                = Vector3.one;
        bool    flag               = false;
        Disease disease            = this.m_PDM.GetDisease(ConsumeEffect.Fever);
        float   currentTimeMinutes = MainLevel.Instance.GetCurrentTimeMinutes();

        if (disease.IsActive())
        {
            int level = disease.m_Level;
            this.m_isIconFeverEnabled = true;
            one.x = this.m_FeverIconStartScale.x * num;
            one.y = this.m_FeverIconStartScale.y * num;
            one.z = this.m_FeverIconStartScale.z * 1f;
            this.m_EnergyFeverIcon.transform.localScale = one;
            this.m_EnergyFeverRadial.fillAmount         = 1f - (currentTimeMinutes - disease.m_StartTime) / disease.m_AutoHealTime;
            if (level > 0)
            {
                this.m_EnergyFeverLevel.enabled = true;
                this.m_EnergyFeverLevel.text    = level.ToString();
            }
            else
            {
                this.m_EnergyFeverLevel.enabled = false;
            }
        }
        else
        {
            this.m_isIconFeverEnabled       = false;
            this.m_EnergyFeverLevel.enabled = false;
        }
        disease = this.m_PDM.GetDisease(ConsumeEffect.ParasiteSickness);
        if (disease.IsActive())
        {
            int level2 = disease.m_Level;
            this.m_IsIconParasiteSicknessEnabled = true;
            one.x = this.m_ParasiteSicknessIconStartScale.x * num;
            one.y = this.m_ParasiteSicknessIconStartScale.y * num;
            one.z = this.m_ParasiteSicknessIconStartScale.z * 1f;
            this.m_EnergyParasiteSicknessIcon.transform.localScale = one;
            if (level2 > 0)
            {
                this.m_EnergyParasiteSicknessLevel.enabled = true;
                this.m_EnergyParasiteSicknessLevel.text    = level2.ToString();
            }
            else
            {
                this.m_EnergyParasiteSicknessLevel.enabled = false;
            }
        }
        else
        {
            this.m_IsIconParasiteSicknessEnabled       = false;
            this.m_EnergyParasiteSicknessLevel.enabled = false;
        }
        int  num2  = 0;
        bool flag2 = false;

        for (int i = 0; i < this.m_PIM.m_Injuries.Count; i++)
        {
            if (this.m_PIM.m_Injuries[i].m_Type == InjuryType.VenomBite || this.m_PIM.m_Injuries[i].m_Type == InjuryType.SnakeBite)
            {
                num2 += this.m_PIM.m_Injuries[i].m_PoisonLevel;
                flag2 = true;
            }
            if (this.m_PIM.m_Injuries[i].m_HealthDecreasePerSec > 0f)
            {
                flag = true;
            }
        }
        if (flag2)
        {
            this.m_isIconPoisonEnabled = true;
            one.x = this.m_PoisonIconStartScale.x * num;
            one.y = this.m_PoisonIconStartScale.y * num;
            one.z = this.m_PoisonIconStartScale.z * 1f;
            this.m_EnergyPoisonIcon.transform.localScale = one;
            if (num2 > 0)
            {
                this.m_EnergyPoisonLevelText.enabled = true;
                this.m_EnergyPoisonLevelText.text    = num2.ToString();
            }
            else
            {
                this.m_EnergyPoisonLevelText.enabled = false;
            }
        }
        else
        {
            this.m_isIconPoisonEnabled           = false;
            this.m_EnergyPoisonLevelText.enabled = false;
        }
        disease = this.m_PDM.GetDisease(ConsumeEffect.FoodPoisoning);
        if (disease.IsActive())
        {
            int level3 = disease.m_Level;
            this.m_isIconFoodPoisonEnabled = true;
            one.x = this.m_FoodPoisonIconStartScale.x * num;
            one.y = this.m_FoodPoisonIconStartScale.y * num;
            one.z = this.m_FoodPoisonIconStartScale.z * 1f;
            this.m_EnergyFoodPoisonIcon.transform.localScale = one;
            this.m_EnergyFoodPoisonRadial.fillAmount         = 1f - (currentTimeMinutes - disease.m_StartTime) / disease.m_AutoHealTime;
            if (level3 > 0)
            {
                this.m_EnergyFoodPoisonLevel.enabled = true;
                this.m_EnergyFoodPoisonLevel.text    = level3.ToString();
            }
            else
            {
                this.m_EnergyFoodPoisonLevel.enabled = false;
            }
        }
        else
        {
            this.m_isIconFoodPoisonEnabled       = false;
            this.m_EnergyFoodPoisonLevel.enabled = false;
        }
        PlayerConditionModule playerConditionModule = PlayerConditionModule.Get();

        if (playerConditionModule.IsNutritionCarboCriticalLevel() || playerConditionModule.IsNutritionFatCriticalLevel() || playerConditionModule.IsNutritionProteinsCriticalLevel() || playerConditionModule.IsHydrationCriticalLevel())
        {
            this.m_isIconNutritionEnabled = true;
            one.x = this.m_NoNutritionIconStartScale.x * num;
            one.y = this.m_NoNutritionIconStartScale.y * num;
            one.z = this.m_NoNutritionIconStartScale.z * 1f;
            this.m_EnergyUsedByNoNutritionIcon.transform.localScale = one;
            if (playerConditionModule.IsHydrationCriticalLevel())
            {
                flag = true;
            }
        }
        else
        {
            this.m_isIconNutritionEnabled = false;
        }
        if (this.m_PIM.GetInjuriesCount() > 0 && (this.m_PIM.GetNumWounds() != this.m_PIM.GetInjuriesCount() || !this.m_PIM.AllWoundsHealing()))
        {
            this.m_isIconWoundsEnabled = true;
            one.x = this.m_WoundsIconStartScale.x * num;
            one.y = this.m_WoundsIconStartScale.y * num;
            one.z = this.m_WoundsIconStartScale.z * 1f;
            this.m_EnergyUsedByWoundsIcon.transform.localScale = one;
        }
        else
        {
            this.m_isIconWoundsEnabled = false;
        }
        this.m_HealthArrowDown.enabled = flag;
        if (flag)
        {
            Color color = this.m_HealthArrowDown.color;
            color.a = 1f;
            if (Mathf.Abs(Mathf.Cos(Time.time * 0.3f)) > 0.9f)
            {
                color.a = Mathf.Abs(Mathf.Sin(Time.time * 2.5f));
            }
            this.m_HealthArrowDown.color = color;
            this.m_HealthArrowUp.enabled = false;
        }
        else if (Time.time - playerConditionModule.m_IncreaseHPLastTime < 3f && playerConditionModule.GetHP() < playerConditionModule.GetMaxHP())
        {
            this.m_HealthArrowUp.enabled = true;
        }
        else
        {
            this.m_HealthArrowUp.enabled = false;
        }
        if (Time.time - playerConditionModule.m_IncreaseEnergyLastTime < 3f)
        {
            this.m_EnergyArrowUp.enabled = true;
            Color color2 = this.m_EnergyArrowUp.color;
            color2.a = Mathf.Abs(Mathf.Sin(Time.time * 2.5f));
            this.m_EnergyArrowUp.color = color2;
        }
        else
        {
            this.m_EnergyArrowUp.enabled = false;
        }
        this.IconsCheckLastFrame();
    }