/// <summary> /// KeyInteraction for Human aka Player 1 /// </summary> /// <returns></returns> private void KeyInteractionHuman() { if (!_humanReachable) { return; } if (Input.GetButtonDown(ButtonNames.HumanInspect)) { _uiManager.HumanFlavourText = _humanFlavourText; if (_itemToUnlock != "" && _objectUnlocked) { _uiManager.HumanFlavourText = _unlockedFlavourTextHuman; } if (_itemToUnlock != "" && !_objectUnlocked) { _uiManager.HumanFlavourText = _lockedFlavourTextHuman; } if (_numButtonHandler != null && _objectUnlocked) { _uiManager.HumanFlavourText = _unlockedFlavourTextHuman; } if (_numButtonHandler != null && !_objectUnlocked) { _uiManager.HumanFlavourText = _lockedFlavourTextHuman; } } if (Input.GetButtonDown(ButtonNames.HumanInteract)) { if (_gameManager.HumanImageCanvasActive || _gameManager.HumanMapActive || _uiManager.InventoryHuman.InventoryActive || _gameManager.HumanNumPadActive) { return; } if (_itemToUnlock != "") { if (string.Equals(_uiManager.InventoryHuman.ItemInHand, _itemToUnlock, StringComparison.CurrentCultureIgnoreCase)) { _objectUnlocked = true; _itemManager.RemoveItemFromHandAndInventory(); } } if (_itemIdToUnlock != "" && _animationUnlocked && _showImageOnInteraction) { _uiManager.ShowImage(CharacterType.Human, _humanImage); } if (_itemIdToUnlock == "" && _showImageOnInteraction) { _uiManager.ShowImage(CharacterType.Human, _humanImage); } if (_lightswitch) { _light.SetActive(!_light.activeSelf); if (_secondLight != null) { _secondLight.SetActive(!_secondLight.activeSelf); } } if (_objectMustUnlockedWithItemForAnimation && !_animationUnlocked) { if (string.Equals(_uiManager.InventoryHuman.ItemInHand, _itemIdToUnlock, StringComparison.CurrentCultureIgnoreCase)) { _animationUnlocked = true; _itemManager.RemoveItemFromHandAndInventory(); _disableAnimationObject.SetActive(false); _enableAnimationObject.SetActive(true); } else { _uiManager.HumanFlavourText = _blockedMessage; return; } } //Object Damage if (_calculateDamageBeforePickup) { if (CalculateDamage()) { return; } } // Disable GameObject and Put the Gameobject in the Inventory if (_canBeTakenToInventory && !_canBePickedUpAfterGhostAction) { _soundManager.Source.clip = _soundManager.PickupSound; _soundManager.Source.Play(); _itemManager.AddItemToInv(_itemName); _uiManager.HumanHoverText = ""; _meshGameObject.SetActive(false); } else if (_canBeTakenToInventory && _canBePickedUpAfterGhostAction) { _uiManager.HumanFlavourText = _blockedMessage; } if (_objectActiveToGetItem) { if (!_ghostActiveObject.activeSelf) { return; } } // Put gameobject only in inventory but disables further inventory adding else if (_canBeTakenButStayInScene && !_itemRequiredToRecieveItem) { _canBeTakenButStayInScene = false; _soundManager.Source.clip = _soundManager.PickupSound; _soundManager.Source.Play(); _itemManager.RemoveItemFromHandAndInventory(); _itemManager.AddItemToInv(_itemName); //Combine Item and Object in scene to get a new Item } if (_canBeTakenButStayInScene && _itemRequiredToRecieveItem) { if (string.Equals(_uiManager.InventoryHuman.ItemInHand, _itemNameRequiredToRecieveItem, StringComparison.CurrentCultureIgnoreCase)) { _soundManager.Source.clip = _soundManager.PickupSound; _soundManager.Source.Play(); _itemManager.RemoveItemFromHandAndInventory(); _itemManager.AddItemToInv(_itemName); _canBeTakenButStayInScene = false; } } if (_objectCanBeDisabledToAvoidDamage) { if (_damageDisabled) { return; } _enabledObject.SetActive(false); _disabledObject.SetActive(true); _damageDisabled = true; } if (_objectCanBeDisabledToUnblockAnimation) { if (_objectDisabled) { return; } _objectDisabled = true; _disableAnimationObject.SetActive(false); _enableAnimationObject.SetActive(true); } if (_animationBlockedCauseOfObject) { if (!_animationBlockObject._objectDisabled) { _uiManager.HumanFlavourText = _blockedMessage; return; } } if (_animationType == AnimationType.None && _unlockObjectWhenNumButtonActive && !_numButtonHandler.CodeSolved) { _numButtonHandler.OpenButtonField(); } //Starts Animation, if it isnt disabled if (AnimationType == AnimationType.Open) { var unlocked = IsObjectUnlocked(); if (!unlocked) { return; } if (_animationAllowWhenNumButtonActive && !_numButtonHandler.CodeSolved) { _numButtonHandler.OpenButtonField(); return; } if (_animationAllowWhenMapSolved && !_mapHandler.CodeSolved) { _mapHandler.OpenMap(); return; } if (_calculateDamageBeforeAnimation) { CalculateDamage(); } _animationController.StartNewAnimation(this); } //Used for Linked objects if (_animationType == AnimationType.OpenLinkedOnHold) { _secondGameObject.GetComponent <ObjectInteractionListener>().StartAnimation(_meshGameObject); } } }