void UpdateUIHint() { if (interactive == null) { interactionHint.gameObject.SetActive(false); } else { string text; if (interactive.gameObject.CompareTag("Ball")) { if (player.grenadeSystem.magazine.CurrentAmmo == player.grenadeSystem.magazine.maxAmmo) { text = "You can't carry more balls! (throw them with 'G' or RMB)"; } else { text = "Press 'E' to pick up the ball"; } } else if (interactive.gameObject.CompareTag("FoodSack")) { if (player.CurrentWeaponIsTreatGun()) { if (player.treatGun.magazine.CurrentAmmo < player.treatGun.magazine.maxAmmo) { text = "Press 'E' to pick up food"; } else { text = "Your treatgun is full!"; } } else { text = "Wrong weapon!"; } } else if (interactive.CompareTag("Door")) { text = "Press 'E' to answer the door"; } else if (interactive.CompareTag("Phone")) { text = "Press 'E' to answer the phone"; } else { return; } interactionHint.text = text; interactionHint.gameObject.SetActive(true); } }
public override void HandleInput() { if (stateMachine.inputManager.actionInteract.triggered) { Interactive interactive = interactiveIdentifier.PeekMostRelevantInteractive(); if (interactive != null) { System.Type interactiveType = interactive.GetType(); if (interactiveType == typeof(LiftableObject)) { interactiveIdentifier.PopMostrelevantInteractive(); interactive.Interact(); objectManipulator.LiftObject(interactive.gameObject); base.stateMachine.ChangeState(typeof(PlayerLiftingState)); } else if (interactiveType.IsSubclassOf(typeof(Activator)) && interactiveType != typeof(GroundButton) && !interactive.CompareTag("Receptor")) { interactive.Interact(); } else if (interactiveType == typeof(PushableObject)) { interactive.Interact(); objectManipulator.GrabObject(interactive.gameObject); base.stateMachine.ChangeState(typeof(PlayerDraggingState)); interactiveIdentifier.SetInteractPopupShowState(false); } else if (interactiveType == typeof(InteractiveDoor) || interactiveType == typeof(ItemContainer) || interactiveType == typeof(Guardian)) { interactive.Interact(transform.parent.gameObject); interactiveIdentifier.SetInteractPopupShowState(false); interactiveIdentifier.PopMostrelevantInteractive(); } else if (interactiveType == typeof(InteractiveShield)) { interactive.Interact(transform.parent.gameObject); interactiveIdentifier.SetInteractPopupShowState(false); } } } else if (stateMachine.inputManager.actionAttack1.triggered) { if (holdAttackCheckCoroutine == null) { holdAttackCheckCoroutine = StartCoroutine(CheckForAttackHoldInput()); } else { StopCoroutine(holdAttackCheckCoroutine); holdAttackCheckCoroutine = StartCoroutine(CheckForAttackHoldInput()); } stateMachine.inputManager.actionAttack1.canceled += StopCheckForAttackHoldInputCoroutine; } else if (stateMachine.inputManager.actionDefend.triggered && canDefend) { stateMachine.ChangeState(typeof(PlayerDefendingState)); } }