public bool IsStartingInteraction() { if (PlayerProximityActivated.IsIntrusiveGuiOverlayVisible()) { return(false); } KeyCode[] interactionKeys = { KeyCode.Return, KeyCode.Space, KeyCode.O }; if (Input.anyKeyDown) { foreach (KeyCode key in interactionKeys) { if (Input.GetKeyDown(key)) { return(true); } } } return(false); }
// Update is called once per frame void Update() { bool shouldButtonBeActive = true; if (InventoryActive) { ButtonText.text = "Close"; for (int i = 0; i < ingredientUI.Length; i++) { ingredientUI[i].SetActive(GameState.get().ingredients[i]); } } else { ButtonText.text = "Inventory"; if (PlayerProximityActivated.IsIntrusiveGuiOverlayVisible()) { shouldButtonBeActive = false; } } button.SetActive(shouldButtonBeActive); InventoryWindow.SetActive(InventoryActive); if (Input.GetKeyDown(KeyCode.I)) { GetItem("CoolJazz"); GetItem("Bebop"); } }
// Update is called once per frame void Update() { // Remove all player control when we're in dialogue, map, etc. if (PlayerProximityActivated.IsIntrusiveGuiOverlayVisible()) { return; } // Move the player, clamping them to within the boundaries // of the level. var movement = Input.GetAxis("Horizontal"); anim.SetBool("Walking", movement != 0); movement += movementFromButtons; movement *= (moveSpeed * Time.deltaTime); var newPosition = transform.position; newPosition.x += movement; newPosition.x = Mathf.Clamp(newPosition.x, minPosition, maxPosition); transform.position = newPosition; if (movement < 0) { Vector3 mod = new Vector3(OGscale * -1, t.localScale.y, t.localScale.z); t.localScale = mod; } if (movement > 0) { Vector3 mod = new Vector3(OGscale, t.localScale.y, t.localScale.z); t.localScale = mod; } }