Ejemplo n.º 1
0
        private bool Try_OpenSmeltingStation(SmeltingStation station)
        {
            if (InventoryController.Instance.IsClosed)
            {
                bool hasOpened = false;

                if (m_Type == SmeltingStationType.Furnace)
                {
                    hasOpened = InventoryController.Instance.SetState.Try(ET.InventoryState.Furnace);
                }
                else if (m_Type == SmeltingStationType.Campfire)
                {
                    hasOpened = InventoryController.Instance.SetState.Try(ET.InventoryState.Campfire);
                }

                if (hasOpened)
                {
                    m_CurrentStation = station;
                    station.IsBurning.AddChangeListener(OnChanged_IsBurning);

                    station.Progress.AddChangeListener(OnChanged_Progress);
                    m_ProgressBar.fillAmount = m_CurrentStation.Progress.Get();

                    m_Input.Setup(station.InputSlot);
                    m_Fuel.Setup(station.FuelSlot);
                    m_LootContainer.Setup(station.LootSlots);

                    IsBurning.Set(m_CurrentStation.IsBurning.Get());

                    return(true);
                }
            }

            return(false);
        }
Ejemplo n.º 2
0
        private bool Try_OpenLootContainer(LootObject lootObject)
        {
            if (InventoryController.Instance.IsClosed)
            {
                bool hasOpened = InventoryController.Instance.SetState.Try(ET.InventoryState.Loot);

                if (hasOpened)
                {
                    m_CurLootObject = lootObject;
                    m_ItemContainer.Setup(lootObject.ItemHolders);

                    return(true);
                }
            }

            return(false);
        }
Ejemplo n.º 3
0
        private bool Try_OpenAnvil(Anvil anvil)
        {
            if (InventoryController.Instance.IsClosed)
            {
                bool hasOpened = InventoryController.Instance.SetState.Try(ET.InventoryState.Anvil);

                if (hasOpened)
                {
                    m_CurrentAnvil = anvil;
                    m_InputContainer.Setup(anvil.InputHolder);
                    m_ResultContainer.Setup(anvil.ResultHolder);

                    m_CurrentAnvil.RepairProgress.AddChangeListener(OnChanged_RepairProgress);
                    m_CurrentAnvil.InputItemReadyForRepair.AddChangeListener(OnChanged_InputItemIsReadyForRepair);

                    m_ProgressBar.fillAmount = m_CurrentAnvil.RepairProgress.Get();

                    return(true);
                }
            }

            return(false);
        }