Ejemplo n.º 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();
        }
    }
Ejemplo n.º 2
0
 //Called when the player attempts to grab an item while their inventory is full
 public void HUDMessageFull()
 {
     hudText.text = "Inventory Full";
     //Replace this with an image of a texture that convies the idea the inventory is full instead. Something like a little red x
     lastMessage = HUDMessages.InventoryFull;
     StartCoroutine(HoldTimer(2f));
 }
Ejemplo n.º 3
0
    private static void TransferLiquids(LiquidContainer from, LiquidContainer to)
    {
        LiquidContainerInfo liquidContainerInfo  = (LiquidContainerInfo)from.m_Info;
        LiquidContainerInfo liquidContainerInfo2 = (LiquidContainerInfo)to.m_Info;

        if (liquidContainerInfo.m_LiquidType != liquidContainerInfo2.m_LiquidType)
        {
            if (liquidContainerInfo2.m_Amount >= 1f)
            {
                HUDMessages.Get().AddMessage(GreenHellGame.Instance.GetLocalization().Get("Liquids_Conflict", true), null, HUDMessageIcon.None, "", null);
                return;
            }
            liquidContainerInfo2.m_LiquidType = liquidContainerInfo.m_LiquidType;
        }
        float amount = liquidContainerInfo2.m_Amount;

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

        liquidContainerInfo.m_Amount -= num;
        to.ReplRequestOwnership(false);
        to.OnGet();
        from.ReplRequestOwnership(false);
        from.OnPour();
    }
Ejemplo n.º 4
0
 //Called when we open a door
 public void HUDMessageUnlockedDoor()
 {
     StartCoroutine(HoldTimer(2f));
     hudText.text     = "Door unlocked";
     crossHair.sprite = lockCrossHair;//This needs to be changed to an unlocking animation/icon
     crossHair.rectTransform.sizeDelta = new Vector2(20, 20);
     lastMessage = HUDMessages.UnlockDoor;
 }
Ejemplo n.º 5
0
 //Called when we try to open a locked door
 public void HUDMessageLockedDoor()
 {
     StartCoroutine(HoldTimer(2f));
     hudText.text     = "Door is locked";
     crossHair.sprite = lockCrossHair;
     crossHair.rectTransform.sizeDelta = new Vector2(20, 20);
     lastMessage = HUDMessages.LockedDoor;
 }
Ejemplo n.º 6
0
    public void SetupHUDWarning()
    {
        hudMessages = playersVehicle.GetComponentInChildren <HUDMessages>();
        try
        {
            Debug.Log($"TestVAR: {testVar}");
            testVar = "SetupHUDWarning";
            Debug.Log($"TestVAR: {testVar}");
            // Getting the hud
            GameObject hud = GameObject.Find("CollimatedHud");

            // Getting the gear warning so we can copy some parameters
            GameObject gearWarning = GameObject.Find("GearWarning");

            // Adding our HUD Warning message to the vehicle's hud
            hud.gameObject.AddComponent <HUDWarningMessage>();

            HUDWarning = hud.gameObject.GetComponent <HUDWarningMessage>();

            // Getting the text object from the hud warning
            Text hudText = HUDWarning.GetComponentInChildren <Text>();

            // Getting the flight warnings from the vehicle
            HUDWarning.flightWarnings = playersVehicle.GetComponentInChildren <FlightWarnings>();
            //Debug.Log("Creating Engine Fire FlightWarning");


            // Copying the HUDGearWarning text settings
            if (hudText != null)
            {
                hudText = gearWarning.GetComponent <HUDGearWarning>().gameObject.GetComponentInChildren <Text>();
            }
            else
            {
                Debug.Log("hudtext is null???");
            }

            Debug.Log(hudText.color);
            Debug.Log(hudText.text);

            // Setting the warn text params
            HUDWarning.warnText = hudText;

            Debug.Log(HUDWarning.warnText.color);

            // Shifting it up a bit
            HUDWarning.warnText.transform.position = new Vector3(HUDWarning.warnText.transform.position.x, HUDWarning.warnText.transform.position.y + 15, HUDWarning.warnText.transform.position.z);
            HUDWarning.warnText.enabled            = true;
            // Add the clear action
            HUDWarning.flightWarnings.OnClearedWarnings.AddListener(new UnityAction(HUDWarning.OnCleared));

            HUDWarning.gameObject.SetActive(true);
        }
        catch (Exception err)
        {
            Debug.Log("Error adding HUD?");
        }
    }
Ejemplo n.º 7
0
    private void SendTextMessage()
    {
        string text = this.m_Field.text;

        if (text.Trim().Length > 0)
        {
            P2PSession.Instance.SendTextChatMessage(text);
            HUDMessages.Get().AddMessage(GreenHellGame.Instance.GetLocalization().Get("HUDTextChat_MessagePrefixLocalPlayer", true) + text, null, HUDMessageIcon.None, "", null);
        }
    }
Ejemplo n.º 8
0
 //Called when the player is looking at an object they can interact with
 public void HUDMessageInteract()
 {
     if (!holdMessage && lastMessage != HUDMessages.Interact)
     {
         hudText.text     = "Interact";
         crossHair.sprite = handCrossHair;
         crossHair.rectTransform.sizeDelta = new Vector2(25, 25);
         lastMessage = HUDMessages.Interact;
     }
 }
Ejemplo n.º 9
0
 //Called when we are not looking at any interactive object. This resets the hud to default
 public void HUDMessageClear()
 {
     if (!holdMessage && lastMessage != HUDMessages.None)
     {
         hudText.text     = "";
         crossHair.sprite = defaultCrossHair;
         crossHair.rectTransform.sizeDelta = new Vector2(5, 5);
         lastMessage = HUDMessages.None;
         lastItem    = null;
     }
 }
Ejemplo n.º 10
0
 //Displays the name of the item the player is looking at
 public void HUDMessageItem(GameObject item)
 {
     if (!holdMessage && item != lastItem)
     {
         lastItem     = item;
         hudText.text = item.name;
         crossHair.rectTransform.sizeDelta = new Vector2(25, 25);
         crossHair.sprite = handCrossHair;
         lastMessage      = HUDMessages.Item;
     }
 }
Ejemplo n.º 11
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);
        }
    }
Ejemplo n.º 12
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);
    }
Ejemplo n.º 13
0
 private void UpdateInputs()
 {
     if (Input.GetMouseButtonUp(0))
     {
         if (this.m_SelectionGet.enabled)
         {
             this.m_Container.Fill(this.m_LiquidSource);
         }
         this.m_Container.StaticPhxRequestRemove();
         this.m_Active = false;
         Inventory3DManager.Get().SetCarriedItem(this.m_Container);
         HUDMessages hudmessages = (HUDMessages)HUDManager.Get().GetHUD(typeof(HUDMessages));
         hudmessages.AddMessage("LiquidType_" + this.m_LiquidSource.m_LiquidType.ToString() + " " + GreenHellGame.Instance.GetLocalization().Get("HUD_Trigger_Taken"), new Color?(Color.white), HUDMessageIcon.None, string.Empty);
     }
 }
Ejemplo n.º 14
0
    private void TransferLiquids(LiquidContainer to)
    {
        LiquidContainerInfo liquidContainerInfo = (LiquidContainerInfo)to.m_Info;

        if (this.m_LiquidType != liquidContainerInfo.m_LiquidType)
        {
            if (liquidContainerInfo.m_Amount > 0f)
            {
                HUDMessages.Get().AddMessage(GreenHellGame.Instance.GetLocalization().Get("Liquids_Conflict"), null, HUDMessageIcon.None, string.Empty);
                return;
            }
            liquidContainerInfo.m_LiquidType = this.m_LiquidType;
        }
        liquidContainerInfo.m_Amount = liquidContainerInfo.m_Capacity;
        to.OnGet();
    }
Ejemplo n.º 15
0
    private void TransferLiquids(LiquidContainer to)
    {
        LiquidContainerInfo liquidContainerInfo = (LiquidContainerInfo)to.m_Info;

        if (this.m_LiquidType != liquidContainerInfo.m_LiquidType)
        {
            if (liquidContainerInfo.m_Amount > 0f)
            {
                HUDMessages.Get().AddMessage(GreenHellGame.Instance.GetLocalization().Get("Liquids_Conflict", true), null, HUDMessageIcon.None, "", null);
                return;
            }
            liquidContainerInfo.m_LiquidType = this.m_LiquidType;
        }
        liquidContainerInfo.m_Amount = liquidContainerInfo.m_Capacity;
        to.OnGet();
        to.ReplRequestOwnership(false);
    }
Ejemplo n.º 16
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);
    }
Ejemplo n.º 17
0
    public void OnSkillAction()
    {
        if (this.m_Value >= Skill.s_MaxValue)
        {
            return;
        }
        int num = Mathf.FloorToInt(this.m_Value);

        this.m_Value += this.m_Progress.Progress(this.m_Value);
        this.m_Value  = Mathf.Clamp(this.m_Value, 0f, Skill.s_MaxValue);
        Localization localization = GreenHellGame.Instance.GetLocalization();
        int          num2         = Mathf.FloorToInt(this.m_Value);

        if (num2 > num && HUDMessages.Get())
        {
            HUDMessages.Get().AddMessage(localization.Get("Skill_" + this.m_Name) + " +" + (num2 - num).ToString(), null, HUDMessageIcon.None, string.Empty);
        }
    }
Ejemplo n.º 18
0
 private void HandleConnect(int connection_id, byte error)
 {
     if (P2PLogFilter.logDebug)
     {
         Debug.Log("P2PSession accepted client:" + connection_id);
     }
     if (error != 0)
     {
         if (this.Status == P2PSession.ESessionStatus.Connecting)
         {
             HUDMessages.Get().AddMessage(GreenHellGame.Instance.GetLocalization().Get("SessionInfo_ConnectionError", true), null, HUDMessageIcon.None, "", null);
         }
         this.OnConnectError(connection_id, error);
         return;
     }
     P2PSession.ESessionStatus status = this.Status;
     this.Status = P2PSession.ESessionStatus.Connected;
 }
Ejemplo n.º 19
0
 public virtual void OnEat(ConsumableInfo info)
 {
     if (info.m_ConsumeEffect == this.m_Type && this.CanApplyConsumeEffect(info))
     {
         this.m_Level += info.m_ConsumeEffectLevel;
         Localization localization = GreenHellGame.Instance.GetLocalization();
         HUDMessages  hudmessages  = (HUDMessages)HUDManager.Get().GetHUD(typeof(HUDMessages));
         string       text         = string.Empty;
         if (info.m_ConsumeEffect == ConsumeEffect.ParasiteSickness)
         {
             text = info.m_ConsumeEffectLevel.ToString("F0") + " " + localization.Get("HUD_ParasiteSickness", true);
             hudmessages.AddMessage(text, null, HUDMessageIcon.ParasiteSickness, "", null);
         }
     }
     this.m_Level = Mathf.Clamp(this.m_Level, 0, this.m_MaxLevel);
     if (this.m_Level == 0)
     {
         this.Deactivate();
     }
 }
Ejemplo n.º 20
0
    public override void OnEat(ConsumableInfo info)
    {
        base.OnEat(info);
        float   num     = UnityEngine.Random.Range(0f, 1f);
        Disease disease = PlayerDiseasesModule.Get().GetDisease(ConsumeEffect.DirtSickness);

        if (num < (float)disease.m_Level * 0.1f)
        {
            ParasiteSickness parasiteSickness = (ParasiteSickness)PlayerDiseasesModule.Get().GetDisease(ConsumeEffect.ParasiteSickness);
            if (parasiteSickness.IsActive())
            {
                parasiteSickness.IncreaseLevel(1);
            }
            else
            {
                PlayerDiseasesModule.Get().RequestDisease(ConsumeEffect.ParasiteSickness, 0f, 1);
            }
            HUDMessages.Get().AddMessage("+1 " + GreenHellGame.Instance.GetLocalization().Get("HUDMessage_ParasiteFromDirt", true), new Color?(Color.white), HUDMessageIcon.ParasiteSickness, string.Empty, this.m_IconIndexesTemp);
        }
    }
Ejemplo n.º 21
0
    private void TransferLiquids(LiquidType liquid_type, LiquidContainer from, ContainerData to)
    {
        LiquidContainerInfo liquidContainerInfo = (LiquidContainerInfo)from.m_Info;

        if (liquid_type != liquidContainerInfo.m_LiquidType)
        {
            if (to.m_Amount > 0f)
            {
                HUDMessages.Get().AddMessage(GreenHellGame.Instance.GetLocalization().Get("Liquids_Conflict", true), null, HUDMessageIcon.None, "", null);
                return;
            }
            this.SetCollectorLiquidType(liquidContainerInfo.m_LiquidType);
        }
        to.m_Amount += liquidContainerInfo.m_Amount;
        if (to.m_Amount > to.m_Capacity)
        {
            to.m_Amount = to.m_Capacity;
        }
        liquidContainerInfo.m_Amount = 0f;
        PlayerAudioModule.Get().PlayWaterSpillSound(1f, false);
    }
Ejemplo n.º 22
0
    private void TransferLiquids(LiquidType liquid_type, ContainerData from, LiquidContainer to)
    {
        LiquidContainerInfo liquidContainerInfo = (LiquidContainerInfo)to.m_Info;

        if (liquid_type != liquidContainerInfo.m_LiquidType)
        {
            if (liquidContainerInfo.m_Amount > 0f)
            {
                HUDMessages.Get().AddMessage(GreenHellGame.Instance.GetLocalization().Get("Liquids_Conflict", true), null, HUDMessageIcon.None, "", null);
                return;
            }
            liquidContainerInfo.m_LiquidType = liquid_type;
        }
        float num = liquidContainerInfo.m_Capacity - liquidContainerInfo.m_Amount;

        num = Mathf.Min(num, from.m_Amount);
        liquidContainerInfo.m_Amount += num;
        to.OnGet();
        from.m_Amount -= num;
        PlayerAudioModule.Get().PlayWaterSpillSound(1f, false);
    }
Ejemplo n.º 23
0
 public void ExecuteTrigger(Trigger trigger, TriggerAction.TYPE action)
 {
     if (this.IsGrabInProgress())
     {
         return;
     }
     if (Time.time - this.m_LastTrigerExecutionTime < 0.1f)
     {
         return;
     }
     if (!trigger)
     {
         return;
     }
     if (this.m_TriggerToExecute)
     {
         if (Time.time - this.m_TriggerToExecuteTime > 2f)
         {
             this.m_TriggerToExecute       = null;
             this.m_TriggerActionToExecute = TriggerAction.TYPE.None;
         }
         return;
     }
     if (trigger.PlayGrabAnimOnExecute(action))
     {
         this.m_TriggerToExecute       = trigger;
         this.m_TriggerActionToExecute = action;
         this.m_TriggerToExecuteTime   = Time.time;
     }
     else
     {
         trigger.OnExecute(action);
         this.m_LastTrigerExecutionTime = Time.time;
     }
     if (action == TriggerAction.TYPE.Use)
     {
         HUDMessages hudmessages = (HUDMessages)HUDManager.Get().GetHUD(typeof(HUDMessages));
         string      text        = GreenHellGame.Instance.GetLocalization().Get(TriggerAction.GetTextPerfect(action)) + ": " + GreenHellGame.Instance.GetLocalization().Get(trigger.GetName());
         if (action == TriggerAction.TYPE.Drink && trigger.IsItem() && ((Item)trigger).m_Info.IsLiquidContainer())
         {
             Localization        localization        = GreenHellGame.Instance.GetLocalization();
             LiquidContainerInfo liquidContainerInfo = (LiquidContainerInfo)((Item)trigger).m_Info;
             text += liquidContainerInfo.m_Amount.ToString("F1");
             text += localization.Get("HUD_Hydration");
         }
         hudmessages.AddMessage(text, null, (action != TriggerAction.TYPE.Drink) ? HUDMessageIcon.None : HUDMessageIcon.Hydration, string.Empty);
     }
     else if (action != TriggerAction.TYPE.Eat)
     {
         if (action == TriggerAction.TYPE.Take || action == TriggerAction.TYPE.TakeHold || action == TriggerAction.TYPE.PickUp)
         {
             Item currentItem = this.m_Player.GetCurrentItem(Hand.Left);
             if (currentItem != null && currentItem.m_Info.m_ID == ItemID.Bow)
             {
                 this.m_Animator.SetBool(TriggerController.s_BGrabItemBow, true);
             }
             else if (currentItem != null && currentItem.m_Info.m_ID == ItemID.Bamboo_Bow)
             {
                 this.m_Animator.SetBool(TriggerController.s_BGrabItemBambooBow, true);
             }
             else if (currentItem && currentItem.m_Info.IsBow())
             {
                 this.m_Animator.SetBool(TriggerController.s_BGrabItemBow, true);
             }
             else if (trigger.PlayGrabAnimOnExecute(action))
             {
                 this.m_Animator.SetBool(TriggerController.s_BGrabItem, true);
             }
         }
         else if (action == TriggerAction.TYPE.DrinkHold)
         {
             this.m_Animator.SetBool(this.m_BDrinkWater, true);
             this.m_TriggerInAction = true;
         }
     }
 }
Ejemplo n.º 24
0
 private void OnTextChat(P2PNetworkMessage net_msg)
 {
     HUDMessages.Get().AddMessage(net_msg.m_Connection.m_Peer.GetDisplayName() + ": " + net_msg.m_Reader.ReadString(), null, HUDMessageIcon.None, "", null);
 }
Ejemplo n.º 25
0
    public InventoryBackpack.InsertResult InsertItem(Item item, ItemSlot slot = null, InventoryCellsGroup group = null, bool can_stack = true, bool drop_if_cant = true, bool notify_if_cant = true, bool can_auto_select_group = true, bool set_pocket = true)
    {
        if (!item.m_Info.m_CanBeAddedToInventory)
        {
            Inventory3DManager.Get().DropItem(item);
            return(InventoryBackpack.InsertResult.CantInsert);
        }
        if (this.m_Items.Contains(item))
        {
            return(InventoryBackpack.InsertResult.AllreadyInInventory);
        }
        bool isStatic = item.gameObject.isStatic;

        item.gameObject.isStatic = false;
        item.transform.parent    = null;
        this.SetBackpackTransform(item.m_Info.m_BackpackPocket);
        if (set_pocket && Inventory3DManager.Get().gameObject.activeSelf)
        {
            Inventory3DManager.Get().SetupPocket(item.m_Info.m_BackpackPocket);
        }
        InventoryBackpack.InsertResult insertResult = InventoryBackpack.InsertResult.None;
        if (item.m_Info.m_BackpackPocket == BackpackPocket.Top)
        {
            insertResult = this.InsertItemTop(item, slot);
        }
        else if (item.m_Info.m_BackpackPocket == BackpackPocket.Left)
        {
            insertResult = this.InsertItemLeft(item, slot);
        }
        else if (item.m_Info.m_BackpackPocket == BackpackPocket.Right)
        {
            insertResult = this.InsertItemRight(item, slot);
        }
        else if (item.m_Info.m_BackpackPocket == BackpackPocket.Main)
        {
            insertResult = this.InsertItemMain(item, slot, group, can_stack, can_auto_select_group);
        }
        else if (item.m_Info.m_BackpackPocket == BackpackPocket.Front)
        {
            insertResult = this.InsertItemFront(item, slot, group, can_stack, can_auto_select_group);
        }
        if (insertResult == InventoryBackpack.InsertResult.Ok)
        {
            this.m_Items.Add(item);
            if (!item.m_CurrentSlot)
            {
                item.transform.parent = base.transform;
            }
            else if (item.m_CurrentSlot == this.m_EquippedItemSlot)
            {
                this.m_EquippedItem = item;
            }
            item.OnAddToInventory();
            item.gameObject.SetActive(Inventory3DManager.Get().gameObject.activeSelf&& item.m_Info.m_BackpackPocket == Inventory3DManager.Get().m_ActivePocket);
            this.OnInventoryChanged();
        }
        else
        {
            item.gameObject.isStatic = isStatic;
            if (notify_if_cant)
            {
                HUDMessages hudmessages = (HUDMessages)HUDManager.Get().GetHUD(typeof(HUDMessages));
                hudmessages.AddMessage(GreenHellGame.Instance.GetLocalization().Get("HUD_NoSpaceInBackpack"), new Color?(Color.red), HUDMessageIcon.None, string.Empty);
                HUDManager.Get().PlaySound("Sounds/HUD/GH_Inventory_Full");
                if (!drop_if_cant)
                {
                    item.ApplyImpulse(new Vector3(0f, 100f, 0f), new Vector3(0f, 0f, UnityEngine.Random.Range(-100f, 100f)));
                }
            }
            if (drop_if_cant)
            {
                Inventory3DManager.Get().DropItem(item);
            }
        }
        this.SetBackpackTransform(Inventory3DManager.Get().m_ActivePocket);
        return(insertResult);
    }
Ejemplo n.º 26
0
 //Called when we want to force the hud to stop displaying any message
 public void HUDMessageForceClear()
 {
     lastMessage = HUDMessages.None;
     holdMessage = false;
 }
Ejemplo n.º 27
0
    private void OnDrink(LiquidData data, float hydration_amount, float fat_amount, float proteins_amount, float carbo_amount, float energy_amount)
    {
        string       text         = string.Empty;
        Localization localization = GreenHellGame.Instance.GetLocalization();
        HUDMessages  hudmessages  = (HUDMessages)HUDManager.Get().GetHUD(typeof(HUDMessages));
        bool         flag         = false;
        bool         flag2        = false;

        for (int i = 0; i < data.m_ConsumeEffects.Count; i++)
        {
            if (data.m_ConsumeEffects[i].m_ConsumeEffect != ConsumeEffect.None && UnityEngine.Random.Range(0f, 1f) <= data.m_ConsumeEffects[i].m_ConsumeEffectChance && data.m_ConsumeEffects[i].m_ConsumeEffectLevel != 0)
            {
                if (data.m_ConsumeEffects[i].m_ConsumeEffectLevel > 0)
                {
                    PlayerDiseasesModule.Get().RequestDisease(data.m_ConsumeEffects[i].m_ConsumeEffect, data.m_ConsumeEffects[i].m_ConsumeEffectDelay, 0);
                    flag = true;
                }
                if (data.m_ConsumeEffects[i].m_ConsumeEffectLevel < 0)
                {
                    flag2 = true;
                }
                if (data.m_ConsumeEffects[i].m_ConsumeEffect == ConsumeEffect.FoodPoisoning)
                {
                    text = data.m_ConsumeEffects[i].m_ConsumeEffectLevel.ToString("F0") + " " + localization.Get("HUD_FoodPoisoning", true);
                    hudmessages.AddMessage(text, null, HUDMessageIcon.FoodPoisoning, "", null);
                }
                else if (data.m_ConsumeEffects[i].m_ConsumeEffect == ConsumeEffect.ParasiteSickness)
                {
                    text = data.m_ConsumeEffects[i].m_ConsumeEffectLevel.ToString("F0") + " " + localization.Get("HUD_ParasiteSickness", true);
                    hudmessages.AddMessage(text, null, HUDMessageIcon.ParasiteSickness, "", null);
                }
            }
        }
        if (flag || flag2)
        {
            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);
        }
        if (energy_amount > 0f)
        {
            text = energy_amount.ToString("F0") + " " + localization.Get("HUD_Energy", true);
            hudmessages.AddMessage(text, null, HUDMessageIcon.Energy, "", null);
        }
        if (hydration_amount > 0f)
        {
            text = hydration_amount.ToString("F0") + " " + localization.Get("HUD_Hydration", true);
            hudmessages.AddMessage(text, null, HUDMessageIcon.Hydration, "", null);
        }
        if (fat_amount > 0f)
        {
            text = fat_amount.ToString("F0") + " " + localization.Get("HUD_Nutrition_Fat", true);
            hudmessages.AddMessage(text, null, HUDMessageIcon.Fat, "", null);
        }
        if (proteins_amount > 0f)
        {
            text = proteins_amount.ToString("F0") + " " + localization.Get("HUD_Nutrition_Protein", true);
            hudmessages.AddMessage(text, null, HUDMessageIcon.Proteins, "", null);
        }
        if (carbo_amount > 0f)
        {
            text = carbo_amount.ToString("F0") + " " + localization.Get("HUD_Nutrition_Carbo", true);
            hudmessages.AddMessage(text, null, HUDMessageIcon.Carbo, "", null);
        }
        text = localization.Get(TriggerAction.GetTextPerfect(TriggerAction.TYPE.Drink), true) + ": " + GreenHellGame.Instance.GetLocalization().Get(data.m_LiquidType.ToString(), true);
        hudmessages.AddMessage(text, null, HUDMessageIcon.None, "", null);
        EventsManager.OnEvent(Enums.Event.Drink, 1, (int)data.m_LiquidType);
        InventoryBackpack.Get().CalculateCurrentWeight();
    }
Ejemplo n.º 28
0
 public void OnAddMapArea()
 {
     HUDMessages.Get().AddMessage(GreenHellGame.Instance.GetLocalization().Get("MSG_Map_New_Location"), null, HUDMessageIcon.None, string.Empty);
     PlayerAudioModule.Get().PlayNotepadEntrySound();
 }