コード例 #1
0
    private void OnEat(ConsumableInfo info)
    {
        if (info.m_ConsumeEffect != ConsumeEffect.None && UnityEngine.Random.Range(0f, 1f) <= info.m_ConsumeEffectChance && info.m_ConsumeEffectLevel >= 0)
        {
            PlayerDiseasesModule.Get().RequestDisease(info.m_ConsumeEffect, info.m_ConsumeEffectDelay, info.m_ConsumeEffectLevel);
        }
        PlayerDiseasesModule.Get().OnEat(info);
        PlayerInjuryModule.Get().OnEat(info);
        if (info.m_Disgusting)
        {
            PlayerAudioModule.Get().PlayEatingDisgustingSound(1f, false);
        }
        else
        {
            PlayerAudioModule.Get().PlayEatingSound(1f, false);
        }
        EventsManager.OnEvent(Enums.Event.Eat, 1, (int)info.m_ID);
        PlayerSanityModule.Get().OnEat(info.m_SanityChange);
        Localization localization = GreenHellGame.Instance.GetLocalization();
        HUDMessages  hudmessages  = (HUDMessages)HUDManager.Get().GetHUD(typeof(HUDMessages));
        string       text         = string.Empty;

        if (info.m_ConsumeEffect == ConsumeEffect.FoodPoisoning)
        {
            text = info.m_ConsumeEffectLevel.ToString("F0") + " " + localization.Get("HUD_FoodPoisoning");
            hudmessages.AddMessage(text, null, HUDMessageIcon.FoodPoisoning, string.Empty);
        }
        if (info.m_AddEnergy > 0f)
        {
            text = info.m_AddEnergy.ToString("F0") + " " + localization.Get("HUD_Energy");
            hudmessages.AddMessage(text, null, HUDMessageIcon.Energy, string.Empty);
        }
        if (info.m_Water > 0f)
        {
            text = info.m_Water.ToString("F0") + " " + localization.Get("HUD_Hydration");
            hudmessages.AddMessage(text, null, HUDMessageIcon.Hydration, string.Empty);
        }
        if (info.m_Fat > 0f)
        {
            text = info.m_Fat.ToString("F0") + " " + localization.Get("HUD_Nutrition_Fat");
            hudmessages.AddMessage(text, null, HUDMessageIcon.Fat, string.Empty);
        }
        if (info.m_Proteins > 0f)
        {
            text = info.m_Proteins.ToString("F0") + " " + localization.Get("HUD_Nutrition_Protein");
            hudmessages.AddMessage(text, null, HUDMessageIcon.Proteins, string.Empty);
        }
        if (info.m_Carbohydrates > 0f)
        {
            text = info.m_Carbohydrates.ToString("F0") + " " + localization.Get("HUD_Nutrition_Carbo");
            hudmessages.AddMessage(text, null, HUDMessageIcon.Carbo, string.Empty);
        }
        text = localization.Get(TriggerAction.GetTextPerfect(TriggerAction.TYPE.Eat)) + ": " + info.GetNameToDisplayLocalized();
        hudmessages.AddMessage(text, null, HUDMessageIcon.Item, info.m_IconName);
        ItemsManager.Get().OnEat(info);
        if (info.m_ID == ItemID.coca_leafs)
        {
            PlayerCocaineModule.Get().OnEatCocaine();
        }
    }
コード例 #2
0
ファイル: ItemsManager.cs プロジェクト: looki666/Green-Hell
    public void OnItemInNotepadUnlocked(ItemID id)
    {
        if (HUDManager.Get() == null)
        {
            Debug.Log("ItemsManager OnItemInNotepadUnlocked no HUDManager");
            return;
        }
        HUDInfoLog hudinfoLog = (HUDInfoLog)HUDManager.Get().GetHUD(typeof(HUDInfoLog));
        string     title      = GreenHellGame.Instance.GetLocalization().Get("HUD_InfoLog_NewEntry");
        string     text       = GreenHellGame.Instance.GetLocalization().Get(id.ToString());

        if (id == ItemID.Small_Fire || id == ItemID.Campfire || id == ItemID.Campfire_Rack || id == ItemID.Smoker || id == ItemID.Stone_Ring)
        {
            MenuNotepad.Get().SetActiveTab(MenuNotepad.MenuNotepadTab.FirecampTab, true);
        }
        else if (id == ItemID.Leaves_Bed || id == ItemID.Logs_Bed || id == ItemID.Small_Shelter || id == ItemID.Medium_Shelter)
        {
            MenuNotepad.Get().SetActiveTab(MenuNotepad.MenuNotepadTab.ConstructionsTab, true);
        }
        else if (id == ItemID.Cage_Trap || id == ItemID.Fish_Rod_Trap || id == ItemID.Killer_Trap || id == ItemID.Snare_Trap || id == ItemID.Stick_Fish_Trap || id == ItemID.Stone_Trap)
        {
            MenuNotepad.Get().SetActiveTab(MenuNotepad.MenuNotepadTab.TrapsTab, true);
        }
        else if (id == ItemID.Water_Collector || id == ItemID.Water_Filter)
        {
            MenuNotepad.Get().SetActiveTab(MenuNotepad.MenuNotepadTab.WaterConstructionsTab, true);
        }
        else
        {
            MenuNotepad.Get().SetActiveTab(MenuNotepad.MenuNotepadTab.ItemsTab, true);
        }
        MenuNotepad.Get().SetCurrentPageToItem(id);
        hudinfoLog.AddInfo(title, text);
        PlayerAudioModule.Get().PlayNotepadEntrySound();
    }
コード例 #3
0
    public override bool Take()
    {
        if (this.m_Hallucination)
        {
            base.Disappear(true);
            return(false);
        }
        Item item = ItemsManager.Get().CreateItem(this.m_ReplaceInfoName, false);

        if (InventoryBackpack.Get().InsertItem(item, null, null, true, true, true, true, true) != InsertResult.Ok)
        {
            UnityEngine.Object.Destroy(item.gameObject);
            return(false);
        }
        this.UpdateChildrenItems();
        EventsManager.OnEvent(Enums.Event.TakeItem, 1, (int)item.m_Info.m_ID);
        if (base.m_CurrentSlot)
        {
            base.m_CurrentSlot.RemoveItem();
        }
        Player.Get().GetComponent <PlayerAudioModule>().PlayItemSound(item.m_Info.m_GrabSound);
        base.AddItemsCountMessage(item);
        if (item.m_Info != null && item.m_Info.IsHeavyObject())
        {
            PlayerAudioModule.Get().PlayHOPickupSound();
        }
        if (!this.m_IsThisUnlimited)
        {
            UnityEngine.Object.Destroy(base.gameObject);
        }
        return(true);
    }
コード例 #4
0
    private void OnTriggerEnter(Collider other)
    {
        if (this.m_DamageWindow)
        {
            return;
        }
        AI component = other.gameObject.GetComponent <AI>();

        if (component == null)
        {
            return;
        }
        DamageInfo damageInfo = new DamageInfo();

        if (this.m_CurrentMode == FistFightController.Mode.Normal)
        {
            damageInfo.m_Damage = Player.Get().GetParams().m_FistFightNormalDamage *Skill.Get <FistsSkill>().GetDamageMul();
        }
        else
        {
            damageInfo.m_Damage = Player.Get().GetParams().m_FistFightHardDamage *Skill.Get <FistsSkill>().GetDamageMul();
        }
        damageInfo.m_Damager  = base.gameObject;
        damageInfo.m_HitDir   = base.transform.forward;
        damageInfo.m_Position = ((!this.m_LeftHandCollider.enabled) ? this.m_RightHandCollider.bounds.center : this.m_LeftHandCollider.bounds.center);
        bool flag = component.TakeDamage(damageInfo);

        if (flag)
        {
            PlayerAudioModule.Get().PlayHitSound(1f, false);
        }
        this.m_LeftHandCollider.enabled  = false;
        this.m_RightHandCollider.enabled = false;
        Skill.Get <FistsSkill>().OnSkillAction();
    }
コード例 #5
0
    public void StartSleeping(RestingPlace place = null, bool block_moves = true)
    {
        if (!Player.Get().CanSleep())
        {
            return;
        }
        this.m_RestingPlace = place;
        this.SetupSurroundingConstructions();
        if (block_moves)
        {
            this.m_Player.BlockMoves();
            this.m_Player.BlockRotation();
        }
        this.m_StartSleepingTime = Time.time;
        this.m_StartSleepHour    = this.m_Sky.Cycle.Hour;
        this.m_Progress          = 0f;
        this.m_PrevProgress      = 0f;
        this.m_HourProgress      = 0;
        HUDSleeping.Get().gameObject.SetActive(true);
        MenuInGameManager.Get().HideMenu();
        Item currentItem = this.m_Player.GetCurrentItem(Hand.Right);

        if (currentItem != null && currentItem.m_Info.IsHeavyObject())
        {
            this.m_Player.DropItem(currentItem);
        }
        Player.Get().StartController(PlayerControllerType.Sleep);
        PlayerAudioModule.Get().PlaySleepSound();
        GreenHellGame.Instance.SetSnapshot(AudioMixerSnapshotGame.Sleep, 0.5f);
        if (Inventory3DManager.Get().IsActive())
        {
            Inventory3DManager.Get().Deactivate();
        }
    }
コード例 #6
0
    protected override void OnEnable()
    {
        base.OnEnable();
        this.m_Animator.SetBool(this.m_BSwim, true);
        this.m_Player.m_UseGravity = false;
        this.m_DiveBone            = this.m_Player.gameObject.transform.FindDeepChild("mixamorig:Spine");
        this.m_SwimBones.Clear();
        this.m_SwimBones.Add(this.m_Player.gameObject.transform.FindDeepChild("mixamorig:Eye.R"));
        this.m_WantedSpeed.Force(this.m_CharacterController.velocity);
        this.m_SwimBonesRotation = this.m_LookController.m_LookDev.y;
        this.m_DiveBonesRotation = 0f;
        if (Inventory3DManager.Get().gameObject.activeSelf)
        {
            Inventory3DManager.Get().Deactivate();
        }
        this.m_State = SwimState.Swim;
        if (this.m_Player.m_FPPController.m_TimeInAir > 1f)
        {
            this.m_CheckHighSpeed = true;
            PlayerAudioModule.Get().PlayFallIntoWaterSound();
        }
        else
        {
            PlayerAudioModule.Get().PlayFeetLandingSound(1f, false);
        }
        Item currentItem = Player.Get().GetCurrentItem();

        if (currentItem && currentItem.GetInfoID() == ItemID.Fire)
        {
            Player.Get().DropItem(currentItem);
        }
        Player.Get().StopAim();
        this.m_SmoothPos.Force(base.transform.position);
        DialogsManager.Get().StopDialog();
    }
コード例 #7
0
ファイル: MudMixer.cs プロジェクト: Blightbuster/Green-Hell
 public void OnInsertItem(ItemSlot slot)
 {
     if (slot == this.m_WaterSlot)
     {
         Item item = slot.m_Item;
         LiquidContainerInfo liquidContainerInfo = (LiquidContainerInfo)item.m_Info;
         float waterAmount = this.m_WaterAmount;
         this.m_WaterAmount += liquidContainerInfo.m_Amount;
         this.m_WaterAmount  = Mathf.Min(this.m_WaterAmount, this.m_RequiredWaterAmount);
         float num = this.m_WaterAmount - waterAmount;
         liquidContainerInfo.m_Amount -= num;
         slot.RemoveItem();
         InventoryBackpack.Get().InsertItem(item, null, null, true, true, true, true, true);
         if (this.m_WaterAmount >= this.m_RequiredWaterAmount)
         {
             this.SetState(MudMixer.State.Full);
         }
         if (num > 0f)
         {
             PlayerAudioModule.Get().PlayWaterSpillSound(1f, false);
             return;
         }
     }
     else if (slot == this.m_AshSlot)
     {
         UnityEngine.Object.Destroy(slot.m_Item.gameObject);
         this.SetState(MudMixer.State.WaitingForWater);
     }
 }
コード例 #8
0
    public void GiveDamage(AI ai)
    {
        if (this.m_CurrentMode == FistFightController.Mode.Normal)
        {
            this.m_DamageInfo.m_Damage = Player.Get().GetParams().m_FistFightNormalDamage *Skill.Get <FistsSkill>().GetDamageMul();
        }
        else
        {
            this.m_DamageInfo.m_Damage = Player.Get().GetParams().m_FistFightHardDamage *Skill.Get <FistsSkill>().GetDamageMul();
        }
        this.m_DamageInfo.m_Damager  = base.gameObject;
        this.m_DamageInfo.m_HitDir   = base.transform.forward;
        this.m_DamageInfo.m_Position = (this.m_LeftHandCollider.enabled ? this.m_LeftHandCollider.bounds.center : this.m_RightHandCollider.bounds.center);
        if (ai.TakeDamage(this.m_DamageInfo))
        {
            PlayerAudioModule.Get().PlayFistsHitSound();
        }
        this.m_LeftHandCollider.enabled  = false;
        this.m_RightHandCollider.enabled = false;
        bool flag = true;

        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)
        {
            flag = false;
        }
        if (flag)
        {
            Skill.Get <FistsSkill>().OnSkillAction();
        }
    }
コード例 #9
0
 public override void DestroyMe(bool check_connected = true)
 {
     base.DestroyMe(check_connected);
     if (this.m_CollectorData.m_Amount > 0f || this.m_ContainerData.m_Amount > 0f)
     {
         PlayerAudioModule.Get().PlayWaterSpillSound(1f, false);
     }
 }
コード例 #10
0
 public override void OnAnimEvent(AnimEventID id)
 {
     if (id == AnimEventID.LadderSound)
     {
         PlayerAudioModule.Get().PlayLadderSound();
         return;
     }
     base.OnAnimEvent(id);
 }
コード例 #11
0
    private void OnClickLimb(Limb limb)
    {
        switch (limb)
        {
        case Limb.LArm:
        {
            PlayerAudioModule.Get().PlayBILeftArmStart();
            RawImage[] limbCurrentSelections = this.m_LimbCurrentSelections;
            for (int i = 0; i < limbCurrentSelections.Length; i++)
            {
                limbCurrentSelections[i].enabled = false;
            }
            this.m_LimbCurrentSelections[0].enabled = true;
            return;
        }

        case Limb.RArm:
        {
            PlayerAudioModule.Get().PlayBIRightArmStart();
            RawImage[] limbCurrentSelections = this.m_LimbCurrentSelections;
            for (int i = 0; i < limbCurrentSelections.Length; i++)
            {
                limbCurrentSelections[i].enabled = false;
            }
            this.m_LimbCurrentSelections[1].enabled = true;
            return;
        }

        case Limb.LLeg:
        {
            PlayerAudioModule.Get().PlayBILeftLegStart();
            RawImage[] limbCurrentSelections = this.m_LimbCurrentSelections;
            for (int i = 0; i < limbCurrentSelections.Length; i++)
            {
                limbCurrentSelections[i].enabled = false;
            }
            this.m_LimbCurrentSelections[2].enabled = true;
            return;
        }

        case Limb.RLeg:
        {
            PlayerAudioModule.Get().PlayBIRightLegStart();
            RawImage[] limbCurrentSelections = this.m_LimbCurrentSelections;
            for (int i = 0; i < limbCurrentSelections.Length; i++)
            {
                limbCurrentSelections[i].enabled = false;
            }
            this.m_LimbCurrentSelections[3].enabled = true;
            return;
        }

        default:
            return;
        }
    }
コード例 #12
0
    public void OnAddStoryEvent()
    {
        this.UpdatePrevNextButtons();
        HUDInfoLog hudinfoLog = (HUDInfoLog)HUDManager.Get().GetHUD(typeof(HUDInfoLog));
        string     title      = GreenHellGame.Instance.GetLocalization().Get("MSG_Notepad_Story_NewEntry");

        this.SetActiveTab(MenuNotepad.MenuNotepadTab.StoryTab, true);
        hudinfoLog.AddInfo(title, string.Empty);
        PlayerAudioModule.Get().PlayNotepadEntrySound();
    }
コード例 #13
0
 public void Spill(float amount = -1f)
 {
     if (this.m_LCInfo.m_Amount == 0f)
     {
         return;
     }
     this.m_LCInfo.m_Amount = ((amount >= 0f) ? (this.m_LCInfo.m_Amount - amount) : 0f);
     this.m_LCInfo.m_Amount = Mathf.Clamp(this.m_LCInfo.m_Amount, 0f, this.m_LCInfo.m_Capacity);
     PlayerAudioModule.Get().PlayWaterSpillSound(1f, false);
 }
コード例 #14
0
 public virtual void Spill(float amount = -1f)
 {
     if (this.m_LCInfo.m_Amount == 0f)
     {
         return;
     }
     this.ReplRequestOwnership(false);
     this.m_LCInfo.m_Amount = ((amount < 0f) ? 0f : (this.m_LCInfo.m_Amount - amount));
     this.m_LCInfo.m_Amount = Mathf.Clamp(this.m_LCInfo.m_Amount, 0f, this.m_LCInfo.m_Capacity);
     PlayerAudioModule.Get().PlayWaterSpillSound(1f, false);
 }
コード例 #15
0
ファイル: Shower.cs プロジェクト: Blightbuster/Green-Hell
 public virtual void OnInsertItem(ItemSlot slot)
 {
     if (slot == this.m_ItemSlot)
     {
         Item item = slot.m_Item;
         this.FillWithLiquid(item);
         slot.RemoveItem();
         InventoryBackpack.Get().InsertItem(item, null, null, true, true, true, true, true);
         PlayerAudioModule.Get().PlayWaterSpillSound(1f, false);
     }
 }
コード例 #16
0
 protected override void OnEnable()
 {
     base.OnEnable();
     this.m_Animator.SetBool(this.m_BWatch, true);
     Watch.Get().gameObject.SetActive(true);
     PlayerAudioModule.Get().PlayWatchShowSound();
     this.m_InInventory = Inventory3DManager.Get().gameObject.activeSelf;
     if (this.m_InInventory)
     {
         Inventory3DManager.Get().Deactivate();
     }
 }
コード例 #17
0
ファイル: SwimController.cs プロジェクト: looki666/Green-Hell
 public override void OnAnimEvent(AnimEventID id)
 {
     base.OnAnimEvent(id);
     if (this.m_State == SwimState.Dive && (id == AnimEventID.DiveSound0 || id == AnimEventID.DiveSound1 || id == AnimEventID.DiveSound2))
     {
         PlayerAudioModule.Get().PlayDiveSound();
     }
     else if (this.m_State == SwimState.Swim && (id == AnimEventID.SwimSound0 || id == AnimEventID.SwimSound1 || id == AnimEventID.SwimSound2))
     {
         PlayerAudioModule.Get().PlaySwimSound();
     }
 }
コード例 #18
0
 protected override void OnDisable()
 {
     base.OnDisable();
     this.m_Animator.SetBool(this.m_BWatch, false);
     Watch.Get().gameObject.SetActive(false);
     PlayerAudioModule.Get().PlayWatchHideSound();
     if (this.m_InInventory)
     {
         Player.Get().m_OpenBackpackSheduled = true;
         this.m_InInventory = false;
     }
 }
コード例 #19
0
    public void OnAddMapArea()
    {
        if (SaveGame.m_State != SaveGame.State.None)
        {
            return;
        }
        HUDInfoLog hudinfoLog = (HUDInfoLog)HUDManager.Get().GetHUD(typeof(HUDInfoLog));
        string     title      = GreenHellGame.Instance.GetLocalization().Get("MSG_Map_New_Location", true);

        this.SetActiveTab(MenuNotepad.MenuNotepadTab.StoryTab, true);
        hudinfoLog.AddInfo(title, string.Empty, HUDInfoLogTextureType.Map);
        PlayerAudioModule.Get().PlayNotepadEntrySound();
    }
コード例 #20
0
    private void CreateConstruction()
    {
        Item item = null;

        item = ItemsManager.Get().CreateItem(this.m_ResultItemID, true, base.transform.position, base.transform.rotation);
        if (this.m_PlacingCondition == ConstructionGhost.GhostPlacingCondition.NeedFirecamp)
        {
            IFirecampAttach[] components = item.gameObject.GetComponents <IFirecampAttach>();
            foreach (IFirecampAttach firecampAttach in components)
            {
                firecampAttach.SetFirecamp(this.m_Firecamp);
            }
        }
        if (this.m_FirecampRacks.Count > 0 && ItemInfo.IsFirecamp(item.GetInfoID()))
        {
            foreach (FirecampRack firecampRack in this.m_FirecampRacks)
            {
                IFirecampAttach[] components2 = firecampRack.gameObject.GetComponents <IFirecampAttach>();
                foreach (IFirecampAttach firecampAttach2 in components2)
                {
                    firecampAttach2.SetFirecamp((Firecamp)item);
                }
            }
        }
        if (this.m_Smoker && ItemInfo.IsFirecamp(item.GetInfoID()))
        {
            IFirecampAttach[] components3 = this.m_Smoker.gameObject.GetComponents <IFirecampAttach>();
            foreach (IFirecampAttach firecampAttach3 in components3)
            {
                firecampAttach3.SetFirecamp((Firecamp)item);
            }
        }
        if (this.m_ConstructionObjectName.Length > 0)
        {
            item.gameObject.name = this.m_ConstructionObjectName;
        }
        ScenarioAction.OnItemCreated(item.gameObject);
        ScenarioCndTF.OnItemCreated(item.gameObject);
        EventsManager.OnEvent(Enums.Event.Build, 1, (int)this.m_ResultItemID);
        HUDMessages hudmessages = (HUDMessages)HUDManager.Get().GetHUD(typeof(HUDMessages));

        hudmessages.AddMessage(GreenHellGame.Instance.GetLocalization().Get(this.m_ResultItemID.ToString()) + " " + GreenHellGame.Instance.GetLocalization().Get("HUDConstruction_Created"), null, HUDMessageIcon.None, string.Empty);
        PlayerAudioModule.Get().PlayBuildCompletedSound();
        ItemsManager.Get().OnCreateItem(this.m_ResultItemID);
        item.SetLayer(item.transform, LayerMask.NameToLayer("Item"));
        foreach (IGhostObserver ghostObserver in this.m_Observers)
        {
            ghostObserver.OnCreateConstruction(this, item);
        }
    }
コード例 #21
0
    private void OnDrink(LiquidData data, float hydration_amount, float fat_amount, float proteins_amount, float carbo_amount, float energy_amount)
    {
        if (data.m_ConsumeEffect != ConsumeEffect.None && UnityEngine.Random.Range(0f, 1f) <= data.m_ConsumeEffectChance && data.m_ConsumeEffectLevel >= 0)
        {
            PlayerDiseasesModule.Get().RequestDisease(data.m_ConsumeEffect, data.m_ConsumeEffectDelay, data.m_ConsumeEffectLevel);
        }
        PlayerDiseasesModule.Get().OnDrink(data.m_LiquidType, hydration_amount);
        PlayerInjuryModule.Get().OnDrink(data);
        if (data.m_Disgusting)
        {
            PlayerAudioModule.Get().PlayDrinkingDisgustingSound(1f, false);
        }
        else
        {
            PlayerAudioModule.Get().PlayDrinkingSound(1f, false);
        }
        Localization localization = GreenHellGame.Instance.GetLocalization();
        HUDMessages  hudmessages  = (HUDMessages)HUDManager.Get().GetHUD(typeof(HUDMessages));
        string       text         = string.Empty;

        if (energy_amount > 0f)
        {
            text = energy_amount.ToString("F0") + " " + localization.Get("HUD_Energy");
            hudmessages.AddMessage(text, null, HUDMessageIcon.Energy, string.Empty);
        }
        if (hydration_amount > 0f)
        {
            text = hydration_amount.ToString("F0") + " " + localization.Get("HUD_Hydration");
            hudmessages.AddMessage(text, null, HUDMessageIcon.Hydration, string.Empty);
        }
        if (fat_amount > 0f)
        {
            text = fat_amount.ToString("F0") + " " + localization.Get("HUD_Nutrition_Fat");
            hudmessages.AddMessage(text, null, HUDMessageIcon.Fat, string.Empty);
        }
        if (proteins_amount > 0f)
        {
            text = proteins_amount.ToString("F0") + " " + localization.Get("HUD_Nutrition_Protein");
            hudmessages.AddMessage(text, null, HUDMessageIcon.Proteins, string.Empty);
        }
        if (carbo_amount > 0f)
        {
            text = carbo_amount.ToString("F0") + " " + localization.Get("HUD_Nutrition_Carbo");
            hudmessages.AddMessage(text, null, HUDMessageIcon.Carbo, string.Empty);
        }
        text = localization.Get(TriggerAction.GetTextPerfect(TriggerAction.TYPE.Drink)) + ": " + GreenHellGame.Instance.GetLocalization().Get(data.m_LiquidType.ToString());
        hudmessages.AddMessage(text, null, HUDMessageIcon.None, string.Empty);
        EventsManager.OnEvent(Enums.Event.Drink, 1, (int)data.m_LiquidType);
    }
コード例 #22
0
ファイル: WaterFilter.cs プロジェクト: looki666/Green-Hell
    private void Fill(LiquidContainerInfo lc_info)
    {
        if (lc_info.m_Amount == 0f)
        {
            return;
        }
        float amount = this.m_Amount;

        this.m_Amount += lc_info.m_Amount;
        this.m_Amount  = Mathf.Clamp(this.m_Amount, 0f, this.m_Capacity);
        float num = this.m_Amount - amount;

        lc_info.m_Amount -= num;
        PlayerAudioModule.Get().PlayWaterSpillSound(1f, false);
    }
コード例 #23
0
 private void OnSetState(SwimState state)
 {
     if (state == SwimState.Dive)
     {
         PlayerAudioModule.Get().PlayBeforeDivingSound();
         this.UpdateAudioMixer(true);
         GreenHellGame.Instance.SetSnapshot(AudioMixerSnapshotGame.Underwater, 0.5f);
         return;
     }
     if (state == SwimState.Swim)
     {
         this.UpdateAudioMixer(false);
         GreenHellGame.Instance.SetSnapshot(AudioMixerSnapshotGame.Default, 0.5f);
         PlayerAudioModule.Get().PlayAfterDivingSound();
     }
 }
コード例 #24
0
    private void UpdateInputs()
    {
        float axis = Input.GetAxis("Mouse ScrollWheel");

        if (axis > 0.01f)
        {
            this.m_Mode++;
            if (this.m_Mode >= WatchMode.Count)
            {
                this.m_Mode = WatchMode.PlayerParameters;
            }
            if (this.m_Mode == WatchMode.Sanity)
            {
                this.m_Mode = WatchMode.PlayerParameters;
            }
            PlayerAudioModule.Get().PlayWatchSwitchTabSound();
        }
        else if (axis < -0.01f)
        {
            this.m_Mode--;
            if (this.m_Mode < WatchMode.PlayerParameters)
            {
                this.m_Mode = WatchMode.Sanity;
            }
            if (this.m_Mode == WatchMode.Sanity)
            {
                this.m_Mode = WatchMode.Hour;
            }
            PlayerAudioModule.Get().PlayWatchSwitchTabSound();
        }
        if (this.m_Mode == WatchMode.Sanity)
        {
            Watch.Get().SetState(Watch.State.Sanity);
        }
        else if (this.m_Mode == WatchMode.Hour)
        {
            Watch.Get().SetState(Watch.State.Time);
        }
        else if (this.m_Mode == WatchMode.PlayerParameters)
        {
            Watch.Get().SetState(Watch.State.Macronutrients);
        }
        else if (this.m_Mode == WatchMode.Compass)
        {
            Watch.Get().SetState(Watch.State.Compass);
        }
    }
コード例 #25
0
    private void OnChangeSanity(float diff, string text_id)
    {
        HUDMessages hudmessages = (HUDMessages)HUDManager.Get().GetHUD(typeof(HUDMessages));
        string      text        = GreenHellGame.Instance.GetLocalization().Get("HUD_Sanity") + ((diff <= 0f) ? string.Empty : "+") + diff.ToString();

        hudmessages.AddMessage(text, null, HUDMessageIcon.None, string.Empty);
        if (text_id != string.Empty)
        {
            text = GreenHellGame.Instance.GetLocalization().Get(text_id);
            hudmessages.AddMessage(text, null, HUDMessageIcon.None, string.Empty);
        }
        if (this.m_Sanity <= this.m_SanityLevelToPlaySounds)
        {
            PlayerAudioModule.Get().PlaySanityLossSound(1f);
        }
        HUDSanity.Get().OnChangeSanity(diff);
    }
コード例 #26
0
ファイル: SwimController.cs プロジェクト: looki666/Green-Hell
 private void UpdateState()
 {
     if (this.m_State == SwimState.Swim)
     {
         if (this.m_LookController.m_LookDev.y < -this.m_MinAngleToDive && this.m_Inputs.m_Vertical > 0.5f)
         {
             this.m_State = SwimState.Dive;
             PlayerAudioModule.Get().PlayBeforeDivingSound();
             this.UpdateAudioMixer(true);
         }
     }
     else if (this.m_State == SwimState.Dive && this.m_Player.transform.position.y + Player.DEEP_WATER * 0.9f > this.m_Player.GetWaterLevel())
     {
         this.m_State = SwimState.Swim;
         this.UpdateAudioMixer(false);
     }
 }
コード例 #27
0
    private void UpdateHeartBeatSound()
    {
        float proportionalClamp = CJTools.Math.GetProportionalClamp(0f, 1f, (float)this.m_Sanity, 1f, 0f);

        this.m_HeartBeatVolume += (proportionalClamp - this.m_HeartBeatVolume) * Time.deltaTime * 0.2f;
        if (this.m_HeartBeatVolume <= 0f)
        {
            return;
        }
        float proportionalClamp2 = CJTools.Math.GetProportionalClamp(1.5f, 0.2f, (float)this.m_Sanity, 1f, 0.1f);

        if (Time.time - this.m_LastHeartSoundTime >= proportionalClamp2 && !PlayerAudioModule.Get().IsHeartBeatSoundPlaying())
        {
            PlayerAudioModule.Get().PlayHeartBeatSound(this.m_HeartBeatVolume, false);
            this.m_LastHeartSoundTime = Time.time;
        }
    }
コード例 #28
0
 protected override void OnEnable()
 {
     base.OnEnable();
     this.m_Animator.SetInteger(this.m_DeathTypeHash, (int)this.m_DeathType);
     DialogsManager.Get().StopDialog();
     CutscenesManager.Get().StopCutscene();
     AIManager.Get().OnPlayerDie();
     if (this.m_DeathType == DeathController.DeathType.UnderWater)
     {
         PlayerAudioModule.Get().PlayUnderwaterDeathSound();
     }
     else
     {
         PlayerAudioModule.Get().PlayDeathSound();
     }
     this.SetState(DeathController.DeathState.Dying);
     this.m_DeathTime = new float?(Time.time);
 }
コード例 #29
0
 public override void OnAnimEvent(AnimEventID id)
 {
     if (id == AnimEventID.DeathEnd)
     {
         this.SetState(DeathController.DeathState.Death);
         if (ChallengesManager.Get().IsChallengeActive())
         {
             ChallengesManager.Get().FailChallenge();
         }
     }
     else if (id == AnimEventID.DeathFall)
     {
         PlayerAudioModule.Get().PlayBodyFallSound();
     }
     else
     {
         base.OnAnimEvent(id);
     }
 }
コード例 #30
0
 public override void OnAnimEvent(AnimEventID id)
 {
     base.OnAnimEvent(id);
     if (id == AnimEventID.PassingOutFall)
     {
         PlayerAudioModule.Get().PlayBodyFallSound();
         return;
     }
     if (id == AnimEventID.RecoverEnd)
     {
         this.m_Player.UnblockMoves();
         this.m_Player.UnblockRotation();
         this.m_MovesBlocked       = false;
         this.m_PassingOutProgress = 0f;
         this.SetState(ConsciousnessController.ConsciousnessState.None);
         this.m_Animator.SetInteger(this.m_PassOutHash, 0);
         this.Stop();
     }
 }