void Update() { if (pXboxControllerManager == null) { pXboxControllerManager = XboxControllerManager.Instance; } if (_buttonPressedCounter == 0 && base.pXboxControllerManager.GetButtonPressed(base.pPlayerInformation, _interactButton)) { IInteract tInteractable = null; Collider[] tOverlapcapsulehits = Physics.OverlapCapsule(topOfCapsule.position, bottomOfCapsule.position, 0.5f); for (int i = 0; i < tOverlapcapsulehits.Length; i++) { tInteractable = tOverlapcapsulehits[i].GetComponent <IInteract>(); if (tInteractable != null && tInteractable != itemIAmHolding) { #if UNITY_EDITOR Debug.Log(tInteractable); #endif if (tInteractable.GetType() == typeof(ItemBase) && amIHoldingAnItem) { tInteractable = null; continue; } tInteractable.Interact(this); break; } } if (tInteractable == null && amIHoldingAnItem) { DropItem(); } _buttonPressedCounter++; } else if (base.pXboxControllerManager.GetButtonPressed(base.pPlayerInformation, _interactButton)) { _buttonPressedCounter++; } else { _buttonPressedCounter = 0; } }