Exemplo n.º 1
0
    public virtual void OnInsertItem(ItemSlot slot)
    {
        if (this.m_ActiveSlots.Contains(slot))
        {
            return;
        }
        if (!slot.m_Item || !slot.m_Item.m_Info.IsFood())
        {
            return;
        }
        Food food = (Food)slot.m_Item;

        if (!ItemsManager.Get().m_SetupAfterLoad)
        {
            food.m_ProcessDuration = 0f;
        }
        FoodInfo foodInfo = (FoodInfo)slot.m_Item.m_Info;

        if (this.GetResultItemID(foodInfo) == ItemID.None)
        {
            return;
        }
        this.m_ActiveSlots.Add(slot);
        if (foodInfo.m_CanCook || foodInfo.m_CanDry)
        {
            HUDProcess.Get().RegisterProcess(slot.m_Item, slot.m_Item.GetIconName(), this, true);
        }
    }
Exemplo n.º 2
0
 protected override void Start()
 {
     base.Start();
     HUDProcess.Get().RegisterProcess(this.m_CollectorWaterVis, "water_filtering", this, true);
     HUDProcess.Get().RegisterProcess(this.m_ContainerWaterVis, "HUD_drinking_water", this, true);
     this.UpdateWaterVis();
 }
Exemplo n.º 3
0
 public void OnInsertItem(ItemSlot slot)
 {
     if (this.m_TargetContainerSlot == slot)
     {
         ((LiquidContainer)slot.m_Item).Spill(-1f);
         this.m_TargetContainerInfo = (LiquidContainerInfo)slot.m_Item.m_Info;
         this.m_TargetContainerInfo.m_LiquidType = LiquidType.Water;
         HUDProcess.Get().RegisterProcess(slot.m_Item, slot.m_Item.GetIconName(), this, false);
         return;
     }
     if (slot.m_Item.m_Info.IsLiquidContainer())
     {
         Item item = slot.m_Item;
         this.Fill((LiquidContainerInfo)item.m_Info);
         slot.RemoveItem();
         if (InventoryBackpack.Get().InsertItem(item, null, null, true, true, true, true, true) != InsertResult.Ok)
         {
             DebugUtils.Assert("Tomuś, do something with this situation!", true, DebugUtils.AssertType.Info);
         }
         if (Inventory3DManager.Get().isActiveAndEnabled)
         {
             Inventory3DManager.Get().OnLiquidTransfer();
         }
     }
 }
Exemplo n.º 4
0
 protected override void Update()
 {
     base.Update();
     if (!this.m_IsContainer && this.m_ContainerSlot.m_Item)
     {
         this.m_IsContainer = true;
         HUDProcess.Get().RegisterProcess(this.m_ContainerSlot.m_Item, this.m_ContainerSlot.m_Item.GetIconName(), this, false);
     }
 }
Exemplo n.º 5
0
 protected override void Start()
 {
     base.Start();
     if (this.m_State == Forge.State.None)
     {
         this.SetState(Forge.State.WaitingForItem);
     }
     HUDProcess.Get().RegisterProcess(this, "forge_charcoal", this, true);
     FirecampGroupsManager.Get().OnCreateFirecamp(this);
 }
Exemplo n.º 6
0
 protected override void OnDestroy()
 {
     base.OnDestroy();
     AcresManager.Get().UnregisterAcre(this);
     if (this.m_Plant != null)
     {
         UnityEngine.Object.Destroy(this.m_Plant);
     }
     if (this.m_GrownPlant != null)
     {
         UnityEngine.Object.Destroy(this.m_GrownPlant);
     }
     HUDProcess.Get().UnregisterProcess(this);
 }
Exemplo n.º 7
0
    public override void DestroyMe(bool check_connected = true)
    {
        base.DestroyMe(check_connected);
        ItemInfo info = ItemsManager.Get().GetInfo(ItemID.Charcoal);
        int      num  = Mathf.FloorToInt((this.m_BurningLength - this.m_BurningDuration) / info.m_AddForgeBurningTime);

        for (int i = 0; i < num; i++)
        {
            ItemsManager.Get().CreateItem(ItemID.Charcoal, true, base.transform.position + UnityEngine.Random.insideUnitSphere * 0.2f, base.transform.rotation);
        }
        if (this.m_ItemSlot.m_Item)
        {
            HUDProcess.Get().UnregisterProcess(this.m_ItemSlot.m_Item);
            this.m_ItemSlot.RemoveItem();
        }
    }
Exemplo n.º 8
0
 protected override void Start()
 {
     base.Start();
     if (this.m_Acre && !HUDProcess.Get().IsProcessRegistered(this))
     {
         if (this.m_Acre.GetState() == AcreState.Ready)
         {
             HUDProcess.Get().RegisterProcess(this, "plant_icon", this, true);
             return;
         }
         if (this.m_Acre.GetState() == AcreState.Growing || this.m_Acre.GetState() == AcreState.GrownNoFruits)
         {
             HUDProcess.Get().RegisterProcess(this, "grow_icon0", this, true);
         }
     }
 }
Exemplo n.º 9
0
 public virtual void OnRemoveItem(ItemSlot slot)
 {
     if (this.m_ActiveSlots.Contains(slot))
     {
         this.m_ActiveSlots.Remove(slot);
     }
     if (this.m_ProcessedSlots.Contains(slot) && slot.m_Item)
     {
         if (slot.m_Item.m_Info.IsFood() && !((Food)slot.m_Item).m_Burned)
         {
             Skill.Get <CookingSkill>().OnSkillAction();
         }
         this.m_ProcessedSlots.Remove(slot);
     }
     if (slot.m_Item)
     {
         slot.m_Item.enabled = true;
         HUDProcess.Get().UnregisterProcess(slot.m_Item);
     }
 }
Exemplo n.º 10
0
 public virtual void OnRemoveItem(ItemSlot slot)
 {
     if (this.m_ActiveSlots.Contains(slot))
     {
         this.m_ActiveSlots.Remove(slot);
     }
     if ((this.m_Type == FoodProcessor.Type.Fire || this.m_Type == FoodProcessor.Type.Smoker) && this.m_ProcessedSlots.Contains(slot) && slot.m_Item)
     {
         Food food = (Food)slot.m_Item;
         if (!food.m_Burned)
         {
             Skill.Get <CookingSkill>().OnSkillAction();
         }
         this.m_ProcessedSlots.Remove(slot);
     }
     if (slot.m_Item)
     {
         slot.m_Item.enabled = true;
         HUDProcess.Get().UnregisterProcess(slot.m_Item);
     }
 }
Exemplo n.º 11
0
    private void OnEnterState()
    {
        switch (this.m_State)
        {
        case Forge.State.WaitingForItem:
            this.m_Item = null;
            this.m_ItemSlot.gameObject.SetActive(true);
            this.m_ForgingDuration = 0f;
            return;

        case Forge.State.MakingOre:
        case Forge.State.MakingForm:
            this.m_ItemSlot.gameObject.SetActive(false);
            HUDProcess.Get().RegisterProcess(this.m_Item, this.GetProcessIconName(), this, true);
            return;

        case Forge.State.Ore:
            HUDProcess.Get().UnregisterProcess(this.m_Item);
            this.m_Item.m_CurrentSlot.RemoveItem();
            UnityEngine.Object.Destroy(this.m_Item.gameObject);
            this.m_ItemSlot.gameObject.SetActive(false);
            ItemsManager.Get().CreateItem(ItemID.iron_ore_melted, true, this.m_ItemSlot.transform);
            this.SetState(Forge.State.WaitingForItem);
            return;

        case Forge.State.Form:
            HUDProcess.Get().UnregisterProcess(this.m_Item);
            this.m_Item.m_CurrentSlot.RemoveItem();
            UnityEngine.Object.Destroy(this.m_Item.gameObject);
            this.m_ItemSlot.gameObject.SetActive(false);
            ItemsManager.Get().CreateItem(this.m_Item.GetInfoID().ToString() + "_baked", true, this.m_ItemSlot.transform);
            this.SetState(Forge.State.WaitingForItem);
            return;

        default:
            return;
        }
    }
Exemplo n.º 12
0
    private void OnSetState()
    {
        switch (this.m_AcreState)
        {
        case AcreState.NotReady:
            this.DeactivateSlot(this.m_WaterSlot);
            this.DeactivateSlot(this.m_ItemSlot);
            HUDProcess.Get().UnregisterProcess(this);
            return;

        case AcreState.Ready:
            if (this.m_ItemSlot.m_Item)
            {
                UnityEngine.Object.Destroy(this.m_ItemSlot.m_Item.gameObject);
            }
            this.DeactivateSlot(this.m_WaterSlot);
            this.ActivateSlot(this.m_ItemSlot);
            if (!HUDProcess.Get().IsProcessRegistered(this.m_AcreGrowProcess))
            {
                HUDProcess.Get().RegisterProcess(this.m_AcreGrowProcess, "plant_icon", this.m_AcreGrowProcess, true);
                return;
            }
            HUDProcess.Get().SetIcon(this.m_AcreGrowProcess, "plant_icon");
            return;

        case AcreState.Growing:
            this.ActivateSlot(this.m_WaterSlot);
            this.DeactivateSlot(this.m_ItemSlot);
            if (!HUDProcess.Get().IsProcessRegistered(this.m_AcreGrowProcess))
            {
                HUDProcess.Get().RegisterProcess(this.m_AcreGrowProcess, "grow_icon0", this.m_AcreGrowProcess, true);
                return;
            }
            HUDProcess.Get().SetIcon(this.m_AcreGrowProcess, "grow_icon0");
            return;

        case AcreState.Grown:
            this.ReplaceToGrown();
            if (this.m_GrownPlant.GetComponent <AcreRespawnFruits>() != null)
            {
                this.ActivateSlot(this.m_WaterSlot);
            }
            else
            {
                this.DeactivateSlot(this.m_WaterSlot);
            }
            this.DeactivateSlot(this.m_ItemSlot);
            HUDProcess.Get().UnregisterProcess(this.m_AcreGrowProcess);
            return;

        case AcreState.GrownNoFruits:
            this.ActivateSlot(this.m_WaterSlot);
            this.DeactivateSlot(this.m_ItemSlot);
            if (!HUDProcess.Get().IsProcessRegistered(this.m_AcreGrowProcess))
            {
                HUDProcess.Get().RegisterProcess(this.m_AcreGrowProcess, "grow_icon0", this.m_AcreGrowProcess, true);
                return;
            }
            HUDProcess.Get().SetIcon(this.m_AcreGrowProcess, "grow_icon0");
            return;

        default:
            return;
        }
    }
Exemplo n.º 13
0
    private void OnEnterState(bool from_save)
    {
        switch (this.m_State)
        {
        case CharcoalFurnace.State.WaitingForWood:
            if (this.m_Stand)
            {
                UnityEngine.Object.Destroy(this.m_Stand.gameObject);
                this.m_Stand = null;
            }
            this.m_WoodItemIDs.Clear();
            this.m_CoalValue = 0f;
            HUDProcess.Get().RegisterProcess(this, "charcoal_furnace_wood", this, true);
            this.m_WoodSlot.gameObject.SetActive(true);
            this.m_Door.gameObject.SetActive(false);
            this.m_Door.enabled = false;
            break;

        case CharcoalFurnace.State.WaitingForDoor:
            HUDProcess.Get().UnregisterProcess(this);
            this.m_WoodSlot.gameObject.SetActive(false);
            this.m_Door.Reset();
            this.m_Door.gameObject.SetActive(true);
            this.m_Door.enabled = true;
            break;

        case CharcoalFurnace.State.WaitingForFire:
            this.m_Sound.loop = false;
            this.m_Sound.clip = this.m_BuildDoorSound;
            this.m_Sound.Play();
            this.m_WoodSlot.gameObject.SetActive(false);
            this.m_Door.gameObject.SetActive(true);
            this.m_Door.enabled = false;
            break;

        case CharcoalFurnace.State.Burning:
            this.m_WoodSlot.gameObject.SetActive(false);
            this.m_Door.gameObject.SetActive(true);
            this.m_Door.enabled = false;
            HUDProcess.Get().RegisterProcess(this, "furnace_charcoal_hot", this, true);
            this.m_Effects.SetActive(true);
            this.m_BurningDuration = 0f;
            this.m_Sound.clip      = this.m_FireSound;
            this.m_Sound.loop      = true;
            this.m_Sound.Play();
            break;

        case CharcoalFurnace.State.DestroyDoor:
            this.m_WoodItemIDs.Clear();
            this.m_WoodSlot.gameObject.SetActive(false);
            this.m_Door.gameObject.SetActive(true);
            this.m_Door.enabled = false;
            HUDProcess.Get().UnregisterProcess(this);
            this.m_Effects.SetActive(false);
            this.m_Sound.Stop();
            break;

        case CharcoalFurnace.State.Ready:
            this.m_CoalValue = 0f;
            this.CreateStand(from_save);
            this.m_Stand.enabled = true;
            this.m_WoodSlot.gameObject.SetActive(false);
            this.m_Door.gameObject.SetActive(false);
            this.m_Door.enabled = false;
            this.m_Sound.clip   = this.m_RemoveDoorSound;
            this.m_Sound.loop   = false;
            this.m_Sound.Play();
            break;
        }
        this.UpdateVis();
    }
Exemplo n.º 14
0
 protected override void Start()
 {
     base.Start();
     HUDProcess.Get().RegisterProcess(this, "HUD_drinking_water", this, true);
     this.m_ItemSlot.m_ItemTypeList.Add(ItemType.LiquidContainer);
 }
Exemplo n.º 15
0
 protected override void Start()
 {
     base.Start();
     HUDProcess.Get().RegisterProcess(this, this.GetIconName(), this, true);
 }
Exemplo n.º 16
0
    public void UpdateProcessing()
    {
        if (!ItemsManager.Get())
        {
            return;
        }
        float num = MainLevel.Instance.m_TODSky.Cycle.GameTimeDelta;

        if (HUDSleeping.Get().GetState() == HUDSleepingState.Progress)
        {
            num = SleepController.Get().m_HoursDelta;
        }
        else if (ConsciousnessController.Get().IsUnconscious())
        {
            num = ConsciousnessController.Get().m_HoursDelta;
        }
        foreach (ItemSlot itemSlot in this.m_ActiveSlots)
        {
            Food food = (Food)itemSlot.m_Item;
            if (this.m_Firecamp)
            {
                if (!this.m_Firecamp.m_Burning)
                {
                    if (food.m_ProcessDuration > 0f)
                    {
                        food.m_ProcessDuration -= num;
                    }
                    else
                    {
                        food.m_ProcessDuration = 0f;
                    }
                    if (!itemSlot.gameObject.activeSelf)
                    {
                        itemSlot.gameObject.SetActive(true);
                    }
                    if (!itemSlot.m_Item.enabled)
                    {
                        itemSlot.m_Item.enabled = true;
                        continue;
                    }
                    continue;
                }
            }
            else if (this.m_Type != FoodProcessor.Type.Dryer && (!this.m_ConnectedFirecamp || !this.m_ConnectedFirecamp.m_Burning))
            {
                if (food.m_ProcessDuration > 0f)
                {
                    food.m_ProcessDuration -= num;
                }
                else
                {
                    food.m_ProcessDuration = 0f;
                }
                if (!itemSlot.gameObject.activeSelf)
                {
                    itemSlot.gameObject.SetActive(true);
                }
                if (!itemSlot.m_Item.enabled)
                {
                    itemSlot.m_Item.enabled = true;
                    continue;
                }
                continue;
            }
            if (this.m_Type == FoodProcessor.Type.Dryer)
            {
                if (!RainManager.Get().IsRain() || RainManager.Get().IsInRainCutter(base.transform.position))
                {
                    food.m_ProcessDuration += num;
                }
                else if (food.m_ProcessDuration > 0f)
                {
                    food.m_ProcessDuration -= num;
                }
                else
                {
                    food.m_ProcessDuration = 0f;
                }
            }
            else
            {
                food.m_ProcessDuration += num;
            }
            FoodInfo foodInfo = (FoodInfo)itemSlot.m_Item.m_Info;
            if (food.m_ProcessDuration >= this.GetProcessingTime(foodInfo) || this.m_DebugImmediate)
            {
                HUDProcess.Get().UnregisterProcess(itemSlot.m_Item);
                Item item = ItemsManager.Get().CreateItem(this.GetResultItemID(foodInfo), true, itemSlot.m_Item.transform.position, itemSlot.m_Item.transform.rotation);
                itemSlot.ReplaceItem(item);
                if (!this.m_ProcessedSlots.Contains(itemSlot))
                {
                    this.m_ProcessedSlots.Add(itemSlot);
                }
                this.m_DebugImmediate = false;
                if (this.m_Type == FoodProcessor.Type.Fire && !foodInfo.m_CanCook)
                {
                    food.m_Burned = true;
                    break;
                }
                break;
            }
        }
    }
Exemplo n.º 17
0
 public void UpdateProcessing()
 {
     foreach (ItemSlot itemSlot in this.m_ActiveSlots)
     {
         Food food = (Food)itemSlot.m_Item;
         if (this.m_Firecamp)
         {
             if (!this.m_Firecamp.m_Burning)
             {
                 if (food.m_ProcessDuration > 0f)
                 {
                     food.m_ProcessDuration -= MainLevel.Instance.m_TODSky.Cycle.GameTimeDelta;
                 }
                 else
                 {
                     food.m_ProcessDuration = 0f;
                 }
                 if (!itemSlot.gameObject.activeSelf)
                 {
                     itemSlot.gameObject.SetActive(true);
                 }
                 if (!itemSlot.m_Item.enabled)
                 {
                     itemSlot.m_Item.enabled = true;
                 }
                 continue;
             }
         }
         else if (this.m_Type != FoodProcessor.Type.Dryer && (!this.m_ConnectedFirecamp || !this.m_ConnectedFirecamp.m_Burning))
         {
             if (food.m_ProcessDuration > 0f)
             {
                 food.m_ProcessDuration -= MainLevel.Instance.m_TODSky.Cycle.GameTimeDelta;
             }
             else
             {
                 food.m_ProcessDuration = 0f;
             }
             if (!itemSlot.gameObject.activeSelf)
             {
                 itemSlot.gameObject.SetActive(true);
             }
             if (!itemSlot.m_Item.enabled)
             {
                 itemSlot.m_Item.enabled = true;
             }
             continue;
         }
         if (this.m_Type == FoodProcessor.Type.Dryer)
         {
             if (!RainManager.Get().IsRain())
             {
                 food.m_ProcessDuration += MainLevel.Instance.m_TODSky.Cycle.GameTimeDelta;
             }
             else if (food.m_ProcessDuration > 0f)
             {
                 food.m_ProcessDuration -= MainLevel.Instance.m_TODSky.Cycle.GameTimeDelta;
             }
             else
             {
                 food.m_ProcessDuration = 0f;
             }
         }
         else
         {
             food.m_ProcessDuration += MainLevel.Instance.m_TODSky.Cycle.GameTimeDelta;
         }
         FoodInfo foodInfo = (FoodInfo)itemSlot.m_Item.m_Info;
         if (itemSlot.m_Item.enabled)
         {
             if (this.m_Type != FoodProcessor.Type.Dryer)
             {
                 itemSlot.m_Item.enabled = !foodInfo.m_CanCook;
             }
             else
             {
                 itemSlot.m_Item.enabled = !foodInfo.m_CanDry;
             }
         }
         if (food.m_ProcessDuration >= this.GetProcessingTime(foodInfo) || this.m_DebugImmediate)
         {
             HUDProcess.Get().UnregisterProcess(itemSlot.m_Item);
             Item item = this.m_ItemsManager.CreateItem(this.GetResultItemID(foodInfo), true, itemSlot.m_Item.transform.position, itemSlot.m_Item.transform.rotation);
             itemSlot.ReplaceItem(item);
             if (!this.m_ProcessedSlots.Contains(itemSlot))
             {
                 this.m_ProcessedSlots.Add(itemSlot);
             }
             this.m_DebugImmediate = false;
             if (this.m_Type == FoodProcessor.Type.Fire && !foodInfo.m_CanCook)
             {
                 food.m_Burned = true;
             }
             break;
         }
     }
 }
Exemplo n.º 18
0
    private void OnEnterState()
    {
        switch (this.m_State)
        {
        case MudMixer.State.WaitingForClay0:
            this.m_AshSlot.gameObject.SetActive(false);
            this.m_WaterSlot.gameObject.SetActive(false);
            this.m_Mud0.Reset();
            this.m_Mud0.gameObject.SetActive(true);
            this.m_Mud0.enabled = true;
            this.m_Mud1.gameObject.SetActive(false);
            this.m_Mud1.enabled = false;
            this.m_Ash.gameObject.SetActive(false);
            this.m_Ash.enabled = false;
            return;

        case MudMixer.State.WaitingForClay1:
            this.m_AshSlot.gameObject.SetActive(false);
            this.m_WaterSlot.gameObject.SetActive(false);
            this.m_Mud0.gameObject.SetActive(true);
            this.m_Mud0.enabled = false;
            this.m_Mud1.Reset();
            this.m_Mud1.gameObject.SetActive(true);
            this.m_Mud1.enabled = true;
            this.m_Ash.gameObject.SetActive(false);
            this.m_Ash.enabled = false;
            return;

        case MudMixer.State.WaitingForAsh:
            this.m_AshSlot.gameObject.SetActive(false);
            this.m_WaterSlot.gameObject.SetActive(false);
            this.m_Mud0.gameObject.SetActive(true);
            this.m_Mud0.enabled = false;
            this.m_Mud1.gameObject.SetActive(true);
            this.m_Mud1.enabled = false;
            this.m_Ash.Reset();
            this.m_Ash.gameObject.SetActive(true);
            this.m_Ash.enabled = true;
            return;

        case MudMixer.State.WaitingForWater:
            this.m_WaterAmount = 0f;
            HUDProcess.Get().RegisterProcess(this, "HUD_pourOut_water", this, true);
            this.m_AshSlot.gameObject.SetActive(false);
            this.m_WaterSlot.gameObject.SetActive(true);
            this.m_Mud0.gameObject.SetActive(true);
            this.m_Mud0.enabled = false;
            this.m_Mud1.gameObject.SetActive(true);
            this.m_Mud1.enabled = false;
            this.m_Ash.gameObject.SetActive(true);
            this.m_Ash.enabled = false;
            return;

        case MudMixer.State.Full:
            this.m_AshSlot.gameObject.SetActive(false);
            this.m_WaterSlot.gameObject.SetActive(false);
            this.m_Mud0.gameObject.SetActive(true);
            this.m_Mud0.enabled = false;
            this.m_Mud1.gameObject.SetActive(true);
            this.m_Mud1.enabled = false;
            this.m_Ash.gameObject.SetActive(true);
            this.m_Ash.enabled = false;
            HUDProcess.Get().UnregisterProcess(this);
            this.m_WaterAmount = 0f;
            return;

        case MudMixer.State.Mix:
            MudMixerController.Get().SetMixer(this);
            Player.Get().HideWeapon();
            Player.Get().StartController(PlayerControllerType.MudMixer);
            this.m_Sound.clip = this.m_MixingSound;
            this.m_Sound.Play();
            return;

        case MudMixer.State.Ready:
            this.m_Sound.Stop();
            this.m_AshSlot.gameObject.SetActive(false);
            this.m_WaterSlot.gameObject.SetActive(false);
            this.m_Mud0.gameObject.SetActive(false);
            this.m_Mud0.enabled = false;
            this.m_Mud1.gameObject.SetActive(false);
            this.m_Mud1.enabled = false;
            this.m_Ash.gameObject.SetActive(false);
            this.m_Ash.enabled = false;
            return;

        default:
            return;
        }
    }
Exemplo n.º 19
0
 protected override void OnDestroy()
 {
     base.OnDestroy();
     HUDProcess.Get().UnregisterProcess(this);
 }