コード例 #1
0
 protected virtual bool CanAttack()
 {
     return(!MainLevel.Instance.IsPause() && !this.m_Player.GetRotationBlocked() && !Inventory3DManager.Get().gameObject.activeSelf&& !HitReactionController.Get().IsActive() && !base.IsBlock() && !this.IsAttack() && !this.m_Player.m_Aim && !PlayerConditionModule.Get().IsStaminaLevel(this.m_BlockAttackStaminaLevel));
 }
コード例 #2
0
 protected override void Attack()
 {
     if (!this.CanAttack())
     {
         if (!this.m_ComboBlocked && !PlayerConditionModule.Get().IsStaminaLevel(this.m_BlockAttackStaminaLevel))
         {
             AnimatorStateInfo currentAnimatorStateInfo = this.m_Animator.GetCurrentAnimatorStateInfo(1);
             if ((currentAnimatorStateInfo.shortNameHash == this.m_NMeleeAttackRightSwing && currentAnimatorStateInfo.normalizedTime > 0.2f) || currentAnimatorStateInfo.shortNameHash == this.m_ReleaseStateRight1 || (currentAnimatorStateInfo.shortNameHash == this.m_NMeleeAttackRightReturn && currentAnimatorStateInfo.normalizedTime < 0.5f))
             {
                 this.m_ReleaseComboScheduled = true;
             }
             if (currentAnimatorStateInfo.shortNameHash == this.m_NMeleeAttackRightSwing && currentAnimatorStateInfo.normalizedTime > 0.5f && currentAnimatorStateInfo.normalizedTime < 1f && !this.m_Animator.GetBool(this.m_BAttackLeft))
             {
                 this.m_ComboScheduled = true;
             }
             else if (currentAnimatorStateInfo.shortNameHash == this.m_ReleaseStateRight1)
             {
                 this.m_ComboScheduled = true;
             }
             else if (currentAnimatorStateInfo.shortNameHash == this.m_NMeleeAttackLeftSwing && currentAnimatorStateInfo.normalizedTime > 0.5f && currentAnimatorStateInfo.normalizedTime < 1f && !this.m_Animator.GetBool(this.m_BAttackRight))
             {
                 this.m_ComboScheduled = true;
             }
             else if (this.m_Animator.GetBool(this.m_BAttackRightRelease))
             {
                 this.m_Animator.SetBool(this.m_BAttackRight, true);
                 this.m_ComboScheduled = true;
             }
         }
         return;
     }
     if (!this.IsAttack())
     {
         base.Attack();
         bool flag = false;
         if (!TorchController.Get().IsActive() && (this.m_Player.GetFPPController().IsDuck() || this.m_Player.GetLookController().m_LookDev.y < -40f))
         {
             flag = true;
         }
         if (flag)
         {
             this.m_Animator.SetBool(this.m_BAttackUp, true);
             this.m_AttackDirection = AttackDirection.Up;
         }
         else
         {
             this.m_Animator.SetBool(this.m_BAttackRight, true);
             this.m_AttackDirection = AttackDirection.Right;
         }
         if (Time.time - this.m_LastAttackSoundTime > 0.3f)
         {
             this.m_AudioModule.PlayAttackSound(1f, false);
             this.m_LastAttackSoundTime = Time.time;
         }
     }
     this.m_Animator.SetBool(this.m_BAttackRightRelease, false);
     this.m_Animator.SetBool(this.m_BAttackLeftRelease, false);
     this.m_Animator.SetBool(this.m_BAttackUpRelease, false);
     this.m_LastAttackTime        = Time.time;
     this.m_ComboScheduled        = false;
     this.m_ComboBlocked          = false;
     this.m_ReleaseComboScheduled = false;
     this.m_ReleaseCombo          = false;
     this.m_HitObjects.Clear();
 }
コード例 #3
0
 private bool CanThrow()
 {
     return(this.m_State == ItemController.State.None && this.m_Item.GetInfoID() != ItemID.Fire && !Inventory3DManager.Get().gameObject.activeSelf&& (!Player.Get().m_ActiveFightController || !Player.Get().m_ActiveFightController.IsBlock()) && (!Player.Get().m_ActiveFightController || PlayerConditionModule.Get().GetStamina() != 0f));
 }
コード例 #4
0
    private void Hit(CJObject cj_object, Collider coll, Vector3 hit_pos, Vector3 hit_dir)
    {
        Item currentItem = this.m_Player.GetCurrentItem(Hand.Right);

        if (cj_object)
        {
            HumanAI humanAI   = null;
            AI      component = cj_object.GetComponent <AI>();
            if (component && component.IsHuman())
            {
                humanAI = (HumanAI)component;
            }
            if (humanAI)
            {
                if (humanAI.m_Hallucination && humanAI.m_HallucinationDisappearing)
                {
                    return;
                }
                this.HitHumanAI(humanAI, hit_pos, hit_dir);
                this.MakeHitSound(coll.gameObject, currentItem.m_Info.m_ID);
                this.m_AlreadyHit = true;
            }
            else
            {
                Fish component2 = cj_object.GetComponent <Fish>();
                if (component2 && component2.m_ID != AI.AIID.AngelFish && component2.m_ID != AI.AIID.DiscusFish && UnityEngine.Random.Range(0f, 1f) < 0.5f)
                {
                    this.m_AlreadyHit = true;
                }
                else if (base.m_ControllerType == PlayerControllerType.WeaponMelee && component2 && component2.m_ID != AI.AIID.AngelFish && component2.m_ID != AI.AIID.DiscusFish)
                {
                    component2.OnHitByItem(null, hit_pos);
                    this.MakeHitSound(coll.gameObject, currentItem.m_Info.m_ID);
                    this.m_AlreadyHit = true;
                }
            }
            if (component)
            {
                PlayerConditionModule.Get().GetDirtinessAdd(GetDirtyReason.Combat, null);
            }
            if (!this.m_AlreadyHit)
            {
                this.HitObject(cj_object, hit_pos, hit_dir);
            }
        }
        else
        {
            RagdollBone component3 = coll.gameObject.GetComponent <RagdollBone>();
            if (component3 && component3.m_ParentObject)
            {
                DeadBody component4 = component3.m_ParentObject.GetComponent <DeadBody>();
                if (component4)
                {
                    component4.OnTakeDamage(new DamageInfo
                    {
                        m_DamageItem = currentItem,
                        m_Damager    = base.gameObject,
                        m_Position   = hit_pos,
                        m_HitDir     = hit_dir,
                        m_Normal     = -hit_dir
                    });
                    this.m_AlreadyHit = true;
                }
            }
        }
        DamageInfo     damageInfo = new DamageInfo();
        ObjectMaterial component5;

        if (cj_object != null)
        {
            component5 = cj_object.gameObject.GetComponent <ObjectMaterial>();
        }
        else
        {
            component5 = coll.gameObject.GetComponent <ObjectMaterial>();
        }
        EObjectMaterial mat = (component5 == null) ? EObjectMaterial.Unknown : component5.m_ObjectMaterial;

        damageInfo.m_Damage     = currentItem.m_Info.m_DamageSelf * ObjectMaterial.GetDamageSelfMul(mat);
        damageInfo.m_DamageItem = currentItem;
        this.MakeHitSound(coll.gameObject, currentItem.m_Info.m_ID);
        currentItem.TakeDamage(damageInfo);
        this.OnHit();
    }
コード例 #5
0
    protected virtual void HitObject(CJObject obj, Vector3 hit_pos, Vector3 hit_dir)
    {
        bool flag = false;

        if (Time.time - this.m_LastPlayHitSound > 0.5f)
        {
            this.m_AudioModule.PlayHitSound(1f, false);
            this.m_LastPlayHitSound = Time.time;
        }
        if (obj.GetParticleOnHit().Length > 3)
        {
            this.SpawnFX(obj.GetParticleOnHit(), hit_pos);
        }
        Item   currentItem = this.m_Player.GetCurrentItem(Hand.Right);
        Weapon weapon      = null;

        if (currentItem.m_Info.IsWeapon())
        {
            weapon = (Weapon)currentItem;
        }
        bool flag2     = true;
        Item component = obj.GetComponent <Item>();

        if (component && component.m_IsPlant)
        {
            this.m_AlreadyHit = false;
        }
        else
        {
            this.m_AlreadyHit = true;
        }
        if (obj.CanReceiveDamageOfType(currentItem.m_Info.m_DamageType))
        {
            DamageInfo damageInfo = new DamageInfo();
            if (weapon != null)
            {
                WeaponInfo weaponInfo = (WeaponInfo)weapon.m_Info;
                if (obj.IsAI())
                {
                    damageInfo.m_Damage = weaponInfo.m_AnimalDamage;
                    if (((AI)obj).IsDead())
                    {
                        flag2 = false;
                    }
                    else
                    {
                        AI ai = (AI)obj;
                        if (ai && ai.m_ID == AI.AIID.ArmadilloThreeBanded && ai.m_GoalsModule != null && ai.m_GoalsModule.m_ActiveGoal != null && ai.m_GoalsModule.m_ActiveGoal.m_Type == AIGoalType.Hide)
                        {
                            flag2 = false;
                        }
                    }
                }
                else if (component)
                {
                    if (component.GetInfoID() == ItemID.iron_vein)
                    {
                        damageInfo.m_Damage = weaponInfo.m_IronVeinDamage;
                    }
                    else if (component.m_IsPlant)
                    {
                        damageInfo.m_Damage = weaponInfo.m_PlantDamage;
                        flag = true;
                    }
                    else if (component.m_IsTree)
                    {
                        damageInfo.m_Damage = weaponInfo.m_TreeDamage;
                        flag = true;
                    }
                    else
                    {
                        damageInfo.m_Damage = weaponInfo.m_DefaultDamage;
                    }
                }
                else
                {
                    damageInfo.m_Damage = weaponInfo.m_DefaultDamage;
                }
            }
            else if (component && component.m_IsTree && weapon.m_Info.IsTorch())
            {
                damageInfo.m_Damage = 0f;
            }
            else
            {
                damageInfo.m_Damage = 1000f;
            }
            damageInfo.m_Damage    *= this.GetDamageMultiplier(currentItem);
            damageInfo.m_Damager    = this.m_Player.gameObject;
            damageInfo.m_Position   = hit_pos;
            damageInfo.m_HitDir     = hit_dir;
            damageInfo.m_Normal     = Vector3.up;
            damageInfo.m_DamageItem = currentItem;
            obj.TakeDamage(damageInfo);
            if (flag)
            {
                PlayerConditionModule.Get().GetDirtinessAdd(GetDirtyReason.ChopPlants, null);
            }
            this.HitDestroyableChunkSource(obj.GetComponent <Collider>(), hit_pos, hit_dir, currentItem);
            if (flag2)
            {
                this.ExecuteSkill(currentItem);
            }
        }
    }
コード例 #6
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;
        PlayerConditionModule.Get().m_Dirtiness = (float)((int)this.m_Dirtiness.value);
    }
コード例 #7
0
    private void UpdateDamagePP()
    {
        float num    = 0f;
        float weight = PostProcessManager.Get().GetWeight(PostProcessManager.Effect.Blood);

        if (PlayerConditionModule.Get().IsHPCriticalLevel())
        {
            num = CJTools.Math.GetProportionalClamp(0f, 1f, PlayerConditionModule.Get().GetHP(), PlayerConditionModule.Get().m_CriticalLevel, 0f);
        }
        if (this.m_LastDamageTime > 0f && Time.time - this.m_LastDamageTime < this.m_DamageEffectDuration)
        {
            num = 1f;
        }
        if (PlayerInjuryModule.Get().GetAllInjuriesOfState(InjuryState.Bleeding).Count > 0)
        {
            num = 1f;
        }
        if (weight > 0f && Time.time - this.m_LastDamageTime >= this.m_DamageEffectDuration)
        {
            num = Mathf.Max(num, weight - Time.deltaTime * 0.5f);
        }
        num = (Player.Get().m_DreamPPActive ? 0f : num);
        if (num != weight)
        {
            PostProcessManager.Get().SetWeight(PostProcessManager.Effect.Blood, num);
        }
    }
コード例 #8
0
 private bool CanJump()
 {
     return(PlayerConditionModule.Get().m_Stamina >= PlayerConditionModule.Get().GetStaminaDecrease(StaminaDecreaseReason.Jump) && !Player.Get().GetMovesBlocked() && !InsectsController.Get().IsActive() && !ScenarioManager.Get().IsDream() && !Player.Get().m_Animator.GetBool(TriggerController.Get().m_BDrinkWater) && !Player.Get().m_CurrentLift&& !ScenarioManager.Get().IsBoolVariableTrue("PlayerMechGameEnding"));
 }
コード例 #9
0
ファイル: Disease.cs プロジェクト: Blightbuster/Green-Hell
 protected virtual void ApplyPlayerParams()
 {
     PlayerConditionModule.Get().DecreaseEnergy(this.m_EnergyLossPerSecond * Time.deltaTime);
 }
コード例 #10
0
        public bool GivePlayerDamage(Vector3 world_hit_dir)
        {
            bool  result = false;
            float num    = Player.Get() ? Player.Get().transform.position.Distance(this.m_AI.transform.position) : float.MaxValue;
            float num2   = this.m_AI.m_Params.m_AttackRange;

            if (AI.IsSnake(this.m_AI.m_ID))
            {
                num2 *= 1.5f;
            }
            if (this.m_AI.m_ID == AI.AIID.BlackCaiman)
            {
                num = Player.Get().transform.position.Distance(this.m_AI.GetHeadTransform().position);
                if (!this.m_AI.IsSwimming() && (this.m_AI.GetHeadTransform().position.y < Player.Get().transform.position.y - 1f || this.m_AI.GetHeadTransform().position.y > Player.Get().GetHeadTransform().position.y + 0.75f))
                {
                    if (this.m_AI.m_GoalsModule.m_ActiveGoal != null)
                    {
                        this.m_AI.m_GoalsModule.m_ActiveGoal.m_WasDamage = true;
                    }
                    return(result);
                }
            }
            if (num <= num2 || this.m_AI.m_ID == AI.AIID.BrasilianWanderingSpider)
            {
                float      damage     = this.m_AI.m_Params.m_Damage;
                DamageType damageType = this.m_AI.m_Params.m_DamageType;
                HumanAI    humanAI    = this.m_AI.IsHuman() ? ((HumanAI)this.m_AI) : null;
                if (humanAI)
                {
                    Weapon weapon = (Weapon)humanAI.m_CurrentWeapon;
                    if (weapon)
                    {
                        damage     = ((WeaponInfo)weapon.m_Info).m_PlayerDamage;
                        damageType = weapon.GetDamageType();
                    }
                }
                bool critical_hit = UnityEngine.Random.Range(0f, 1f) < 0.05f * (PlayerConditionModule.Get().GetHP() / PlayerConditionModule.Get().GetMaxHP());
                Player.Get().GiveDamage(base.gameObject, null, damage, this.m_AI.IsHumanAI() ? UnityEngine.Random.insideUnitSphere : world_hit_dir, damageType, this.m_AI.m_Params.m_PoisonLevel, critical_hit);
                result = true;
            }
            if (this.m_AI.m_GoalsModule.m_ActiveGoal != null)
            {
                this.m_AI.m_GoalsModule.m_ActiveGoal.m_WasDamage = true;
            }
            return(result);
        }
コード例 #11
0
ファイル: HUDEnergy.cs プロジェクト: Blightbuster/Green-Hell
    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;
        }
        disease = this.m_PDM.GetDisease(ConsumeEffect.Insomnia);
        if (disease.IsActive())
        {
            int level3 = disease.m_Level;
            this.m_IsIconInsomniaEnabled = true;
            one.x = this.m_InsomniaIconStartScale.x * num;
            one.y = this.m_InsomniaIconStartScale.y * num;
            one.z = this.m_InsomniaIconStartScale.z * 1f;
            this.m_EnergyInsomniaIcon.transform.localScale = one;
            this.m_EnergyInsomniaRadial.fillAmount         = ((Insomnia)disease).m_InsomniaLevel % 1f;
            if (level3 > 0)
            {
                this.m_EnergyInsomniaLevel.enabled = true;
                this.m_EnergyInsomniaLevel.text    = level3.ToString();
            }
            else
            {
                this.m_EnergyInsomniaLevel.enabled = false;
            }
        }
        else
        {
            this.m_IsIconInsomniaEnabled       = false;
            this.m_EnergyInsomniaLevel.enabled = false;
        }
        int    num2   = 0;
        bool   flag2  = false;
        Injury injury = null;
        float  num3   = float.MaxValue;

        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_StartTimeInMinutes < num3)
                {
                    injury = this.m_PIM.m_Injuries[i];
                    num3   = this.m_PIM.m_Injuries[i].m_StartTimeInMinutes;
                }
            }
            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;
            }
            this.m_EnergyPoisonRadial.enabled    = true;
            this.m_EnergyPoisonRadial.fillAmount = 1f - (MainLevel.Instance.GetCurrentTimeMinutes() - injury.m_StartTimeInMinutes) / Injury.s_PoisonAutoDebufTime;
        }
        else
        {
            this.m_isIconPoisonEnabled           = false;
            this.m_EnergyPoisonLevelText.enabled = false;
            this.m_EnergyPoisonRadial.enabled    = false;
        }
        disease = this.m_PDM.GetDisease(ConsumeEffect.FoodPoisoning);
        if (disease.IsActive())
        {
            int level4 = 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 (level4 > 0)
            {
                this.m_EnergyFoodPoisonLevel.enabled = true;
                this.m_EnergyFoodPoisonLevel.text    = level4.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;
        }
        if (this.m_PAM.IsAnyArmorDamaged())
        {
            this.m_IsIconDamagedArmorEnabled = true;
            one.x = this.m_DamagedArmorIconStartScale.x * num;
            one.y = this.m_DamagedArmorIconStartScale.y * num;
            one.z = this.m_DamagedArmorIconStartScale.z * 1f;
            this.m_EnergyArmorDamagedIcon.transform.localScale = one;
        }
        else
        {
            this.m_IsIconDamagedArmorEnabled = false;
        }
        disease = this.m_PDM.GetDisease(ConsumeEffect.DirtSickness);
        if (disease.IsActive())
        {
            this.m_IsIconDirtinessEnabled = true;
            one.x = this.m_DirtinessIconStartScale.x * num;
            one.y = this.m_DirtinessIconStartScale.y * num;
            one.z = this.m_DirtinessIconStartScale.z * 1f;
            this.m_EnergyArmorDamagedIcon.transform.localScale = one;
            this.m_EnergyDirtinessRadial.fillAmount            = this.m_ConditionModule.m_Dirtiness % 100f / 100f;
            if (disease.m_Level > 0)
            {
                this.m_EnergyDirtinessLevel.enabled = true;
                this.m_EnergyDirtinessLevel.text    = disease.m_Level.ToString();
            }
            else
            {
                this.m_EnergyDirtinessLevel.enabled = false;
            }
        }
        else
        {
            this.m_IsIconDirtinessEnabled = 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();
    }
コード例 #12
0
ファイル: BowController.cs プロジェクト: looki666/Green-Hell
 public override void OnInputAction(InputsManager.InputAction action)
 {
     base.OnInputAction(action);
     if (action == InputsManager.InputAction.BowAim)
     {
         if (!Inventory3DManager.Get().gameObject.activeSelf&& this.m_State == BowController.State.Idle && this.m_Arrow != null && Time.time - this.m_EnterStateTime >= 0.5f && !PlayerConditionModule.Get().IsStaminaCriticalLevel())
         {
             this.SetState(BowController.State.AimLoop);
             this.m_Player.StartAim(Player.AimType.Bow);
             this.PlayDrawSound();
         }
     }
     else if (action == InputsManager.InputAction.BowShot)
     {
         if (this.m_State == BowController.State.AimLoop)
         {
             this.SetState(BowController.State.Shot);
             this.m_Player.StopAim();
             this.PlayShotSound();
         }
     }
     else if (action == InputsManager.InputAction.BowCancelAim && this.m_State == BowController.State.AimLoop)
     {
         this.SetState(BowController.State.Idle);
         this.m_Player.StopAim();
     }
 }