コード例 #1
0
    private void InitSliders()
    {
        PlayerConditionModule playerConditionModule = PlayerConditionModule.Get();

        this.m_Proteins.minValue  = 0f;
        this.m_Proteins.maxValue  = playerConditionModule.GetMaxNutritionProtein();
        this.m_Proteins.value     = playerConditionModule.GetNutritionProtein();
        this.m_Fat.minValue       = 0f;
        this.m_Fat.maxValue       = playerConditionModule.GetMaxNutritionFat();
        this.m_Fat.value          = playerConditionModule.GetNutritionFat();
        this.m_Carbo.minValue     = 0f;
        this.m_Carbo.maxValue     = playerConditionModule.GetMaxNutritionCarbo();
        this.m_Carbo.value        = playerConditionModule.GetNutritionCarbo();
        this.m_Hydration.minValue = 0f;
        this.m_Hydration.maxValue = playerConditionModule.GetMaxHydration();
        this.m_Hydration.value    = playerConditionModule.GetHydration();
        this.m_HP.minValue        = 1f;
        this.m_HP.maxValue        = playerConditionModule.GetMaxHP();
        this.m_HP.value           = playerConditionModule.GetHP();
        this.m_Energy.minValue    = 1f;
        this.m_Energy.maxValue    = playerConditionModule.GetMaxEnergy();
        this.m_Energy.value       = playerConditionModule.GetEnergy();
        this.m_Sanity.minValue    = 0f;
        this.m_Sanity.maxValue    = 100f;
        this.m_Sanity.value       = (float)PlayerSanityModule.Get().m_Sanity;
        this.m_Dirtiness.minValue = 0f;
        this.m_Dirtiness.maxValue = PlayerConditionModule.Get().m_MaxDirtiness;
        this.m_Dirtiness.value    = PlayerConditionModule.Get().m_Dirtiness;
    }
コード例 #2
0
    private void Setup()
    {
        this.m_ToggleLimbs.Clear();
        this.m_ToggleLimbsState.Clear();
        this.m_ToggleLimbs.Add(this.m_ToggleLH);
        this.m_ToggleLimbsState.Add(this.m_ToggleLH.isOn);
        this.m_ToggleLimbs.Add(this.m_ToggleRH);
        this.m_ToggleLimbsState.Add(this.m_ToggleRH.isOn);
        this.m_ToggleLimbs.Add(this.m_ToggleLL);
        this.m_ToggleLimbsState.Add(this.m_ToggleLL.isOn);
        this.m_ToggleLimbs.Add(this.m_ToggleRL);
        this.m_ToggleLimbsState.Add(this.m_ToggleRL.isOn);
        this.m_WoundTypeList.Clear();
        for (int i = 0; i < Enum.GetValues(typeof(InjuryType)).Length; i++)
        {
            this.m_WoundTypeList.AddElement(Enum.GetValues(typeof(InjuryType)).GetValue(i).ToString(), -1);
        }
        this.m_WoundTypeList.SetFocus(true);
        this.m_WoundParameters.Clear();
        for (int j = 0; j < 10; j++)
        {
            Transform transform = base.gameObject.transform.FindDeepChild("Wound" + j.ToString());
            if (transform != null)
            {
                Text component = transform.gameObject.GetComponent <Text>();
                this.m_WoundParameters.Add(component);
            }
        }
        PlayerConditionModule playerConditionModule = PlayerConditionModule.Get();

        this.m_Proteins.minValue  = 0f;
        this.m_Proteins.maxValue  = playerConditionModule.GetMaxNutritionProtein();
        this.m_Proteins.value     = playerConditionModule.GetNutritionProtein();
        this.m_Fat.minValue       = 0f;
        this.m_Fat.maxValue       = playerConditionModule.GetMaxNutritionFat();
        this.m_Fat.value          = playerConditionModule.GetNutritionFat();
        this.m_Carbo.minValue     = 0f;
        this.m_Carbo.maxValue     = playerConditionModule.GetMaxNutritionCarbo();
        this.m_Carbo.value        = playerConditionModule.GetNutritionCarbo();
        this.m_Hydration.minValue = 0f;
        this.m_Hydration.maxValue = playerConditionModule.GetMaxHydration();
        this.m_Hydration.value    = playerConditionModule.GetHydration();
        this.m_HP.minValue        = 0f;
        this.m_HP.maxValue        = playerConditionModule.GetMaxHP();
        this.m_HP.value           = playerConditionModule.GetHP();
        this.m_Energy.minValue    = 0f;
        this.m_Energy.maxValue    = playerConditionModule.GetMaxEnergy();
        this.m_Energy.value       = playerConditionModule.GetEnergy();
        this.m_Sanity.minValue    = 0f;
        this.m_Sanity.maxValue    = 100f;
        this.m_Sanity.value       = (float)PlayerSanityModule.Get().m_Sanity;
    }
コード例 #3
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();
    }
コード例 #4
0
    protected override void Update()
    {
        base.Update();
        PlayerInjuryModule    playerInjuryModule    = PlayerInjuryModule.Get();
        PlayerConditionModule playerConditionModule = PlayerConditionModule.Get();

        for (int i = 0; i < this.m_WoundParameters.Count; i++)
        {
            if (i < playerInjuryModule.m_Injuries.Count)
            {
                Injury injury = playerInjuryModule.m_Injuries[i];
                this.m_WoundParameters[i].enabled = true;
                this.m_WoundParameters[i].text    = "Type: " + injury.m_Type.ToString();
                if (injury.m_Type == InjuryType.SmallWoundAbrassion)
                {
                    Text text = this.m_WoundParameters[i];
                    text.text = text.text + " TimeToHeal:" + (injury.GetHealingDuration() - (MainLevel.Instance.GetCurrentTimeMinutes() - injury.m_HealingStartTime)).ToString();
                    Text text2 = this.m_WoundParameters[i];
                    text2.text = text2.text + " HealTimeBonus: " + injury.m_HealingTimeDec.ToString();
                }
                else if (injury.m_Type == InjuryType.SmallWoundScratch)
                {
                    Text text3 = this.m_WoundParameters[i];
                    text3.text = text3.text + " TimeToHeal:" + (injury.GetHealingDuration() - (MainLevel.Instance.GetCurrentTimeMinutes() - injury.m_HealingStartTime)).ToString();
                    Text text4 = this.m_WoundParameters[i];
                    text4.text = text4.text + " HealTimeBonus: " + injury.m_HealingTimeDec.ToString();
                }
                else if (injury.m_Type == InjuryType.Laceration || injury.m_Type == InjuryType.LacerationCat)
                {
                    Text text5 = this.m_WoundParameters[i];
                    text5.text = text5.text + " TimeToHeal:" + (injury.GetHealingDuration() - (MainLevel.Instance.GetCurrentTimeMinutes() - injury.m_HealingStartTime)).ToString();
                    Text text6 = this.m_WoundParameters[i];
                    text6.text = text6.text + " Will transform to: " + injury.m_HealingResultInjuryState.ToString();
                }
                else if (injury.m_Type == InjuryType.VenomBite)
                {
                    Text text7 = this.m_WoundParameters[i];
                    text7.text = text7.text + " TimeToHeal:" + (injury.GetHealingDuration() - (MainLevel.Instance.GetCurrentTimeMinutes() - injury.m_HealingStartTime)).ToString();
                    Text text8 = this.m_WoundParameters[i];
                    text8.text = text8.text + " PoisonLevel: " + injury.m_PoisonLevel.ToString();
                }
                else if (injury.m_Type == InjuryType.SnakeBite)
                {
                    Text text9 = this.m_WoundParameters[i];
                    text9.text = text9.text + " TimeToHeal:" + (injury.GetHealingDuration() - (MainLevel.Instance.GetCurrentTimeMinutes() - injury.m_HealingStartTime)).ToString();
                    Text text10 = this.m_WoundParameters[i];
                    text10.text = text10.text + " PoisonLevel: " + injury.m_PoisonLevel.ToString();
                }
                else if (injury.m_Type == InjuryType.Rash)
                {
                    Text text11 = this.m_WoundParameters[i];
                    text11.text = text11.text + " TimeToHeal:" + (injury.GetHealingDuration() - (MainLevel.Instance.GetCurrentTimeMinutes() - injury.m_StartTimeInMinutes)).ToString();
                    Text text12 = this.m_WoundParameters[i];
                    text12.text = text12.text + " HealTimeBonus: " + injury.m_HealingTimeDec.ToString();
                }
                else if (injury.m_Type == InjuryType.WormHole)
                {
                    Text text13 = this.m_WoundParameters[i];
                    text13.text = text13.text + " TimeToHeal:" + (injury.GetHealingDuration() - (MainLevel.Instance.GetCurrentTimeMinutes() - injury.m_HealingStartTime)).ToString();
                    Text text14 = this.m_WoundParameters[i];
                    text14.text = text14.text + " HealTimeBonus: " + injury.m_HealingTimeDec.ToString();
                }
            }
            else
            {
                this.m_WoundParameters[i].enabled = false;
            }
        }
        WaterCollider waterPlayerInside = WaterBoxManager.Get().GetWaterPlayerInside();

        this.m_LeechCooldownText.text = "Leech chance: ";
        if (waterPlayerInside == null)
        {
            Text leechCooldownText = this.m_LeechCooldownText;
            leechCooldownText.text += "None";
        }
        else
        {
            Text leechCooldownText2 = this.m_LeechCooldownText;
            leechCooldownText2.text += waterPlayerInside.m_LeechChance.ToString();
        }
        Text leechCooldownText3 = this.m_LeechCooldownText;

        leechCooldownText3.text = leechCooldownText3.text + " Time to next leech: " + (playerInjuryModule.GetLeechNextTime() - MainLevel.Instance.GetCurrentTimeMinutes()).ToString();
        Text leechCooldownText4 = this.m_LeechCooldownText;

        leechCooldownText4.text   = leechCooldownText4.text + " CoolDown: " + Injury.s_LeechCooldownInMinutes.ToString();
        this.m_HPText.text        = "HP = " + playerConditionModule.GetHP().ToString() + "/" + playerConditionModule.GetMaxHP().ToString();
        this.m_ConditionText.text = "Condition = " + playerConditionModule.GetEnergy().ToString() + "/" + playerConditionModule.GetMaxEnergy().ToString();
        playerConditionModule.m_NutritionProteins = this.m_Proteins.value;
        playerConditionModule.m_NutritionFat      = this.m_Fat.value;
        playerConditionModule.m_NutritionCarbo    = this.m_Carbo.value;
        playerConditionModule.m_Hydration         = this.m_Hydration.value;
        playerConditionModule.m_HP     = this.m_HP.value;
        playerConditionModule.m_Energy = this.m_Energy.value;
        PlayerSanityModule.Get().m_Sanity = (int)this.m_Sanity.value;
    }