public override void OnInteract(PlayerEventHandler player) { if (m_PickupMethod == PickupMethod.WalkOver || !ItemToAdd) { return; } // TODO: We shouldn't have access to GUI functions here. var inventory = GUIController.Instance.GetContainer("Inventory"); bool added = inventory.TryAddItem(ItemToAdd); if (added) { if (m_OnDestroySound) { GameController.Audio.Play2D(m_OnDestroySound, m_OnDestroyVolume); } MessageDisplayer.Instance.PushMessage(string.Format("Picked up <color=yellow>{0}</color> x {1}", ItemToAdd.Name, ItemToAdd.CurrentInStack)); } Destroy(gameObject); if (!added) { i++; Debug.Log("i"); } }
public override void OnInteract(PlayerEventHandler player) { if (enabled && InventoryController.Instance.OpenLootContainer.Try(this)) { On_InventoryOpened(); InventoryController.Instance.State.AddChangeListener(OnChanged_InventoryController_State); } }
public override void OnInteract(PlayerEventHandler player) { if (!player.Sleep.Active && TimeOfDay.Instance.State.Get() == ET.TimeOfDay.Night) { if (player.StartSleeping.Try(this)) { player.Sleep.ForceStart(); } } }
public override void OnInteract(PlayerEventHandler player) { if(m_Light != null) { m_Light.enabled = !m_Light.enabled; m_ToggleAudio.Play(ItemSelectionMethod.RandomlyButExcludeLast, m_AudioSource, 1f); } else Debug.LogError("No Light component assigned to this Lamp!", this); }
public override void OnInteract(PlayerEventHandler player) { if (m_Type == SmeltingStationType.Campfire) { InventoryController.Instance.OpenCampfire.Try(this); } else if (m_Type == SmeltingStationType.Furnace) { InventoryController.Instance.OpenFurnace.Try(this); } }
private void Awake() { if (!m_ItemDatabase) { Debug.LogError("No ItemDatabase specified, the inventory will be disabled!", this); enabled = false; return; } SetState.SetTryer(TryChange_State); // TODO: We shouldn't have access to GUI functions here. m_AllCollections = GUIController.Instance.Containers; // Create the inventory. // TODO: We shouldn't have access to GUI functions here. m_InventoryCollection = CreateListOfHolders(m_InventorySize); var inventoryCollection = GUIController.Instance.GetContainer("Inventory"); inventoryCollection.Setup(m_InventoryCollection); // Create the hotbar. // TODO: We shouldn't have access to GUI functions here. m_HotbarCollection = CreateListOfHolders(m_HotbarSize); var hotbarCollection = GUIController.Instance.GetContainer("Hotbar"); hotbarCollection.Setup(m_HotbarCollection); // Create the equipment. // TODO: We shouldn't have access to GUI functions here. m_EquipmentHolders = CreateListOfHolders(m_EquipmentList.Count); for (int i = 0; i < m_EquipmentList.Count; i++) { var equipmentGUI = GUIController.Instance.GetContainer(m_EquipmentList[i]); if (equipmentGUI) { equipmentGUI.Setup(new List <ItemHolder>() { m_EquipmentHolders[i] }); } else { Debug.LogErrorFormat(this, "No GUI collection with the name '{0}' was found!", m_EquipmentList[i]); } } m_Player = GameController.LocalPlayer; m_Player.ChangeHealth.AddListener(OnChanged_PlayerHealth); m_Player.Death.AddListener(On_PlayerDeath); }
/// <summary> /// /// </summary> public virtual void OnInteractHold(PlayerEventHandler player) { }
/// <summary> /// /// </summary> public virtual void OnRaycastEnd(PlayerEventHandler player) { }
/// <summary> /// /// </summary> public virtual void OnRaycastUpdate(PlayerEventHandler player) { }
/// <summary> /// /// </summary> public virtual void OnRaycastStart(PlayerEventHandler player) { }
public override void OnInteract(PlayerEventHandler player) { InventoryController.Instance.OpenAnvil.Try(this); }