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); }
private void OnChanged_InventoryState() { if (m_CurrentStation && InventoryController.Instance.IsClosed) { m_CurrentStation.IsBurning.RemoveChangeListener(OnChanged_IsBurning); m_CurrentStation.Progress.RemoveChangeListener(OnChanged_Progress); m_CurrentStation = null; } }