// Update is called once per frame void Update() { if (activated) { float verticalAxis = Input.GetAxisRaw("Vertical"); float horizontalAxis = Input.GetAxisRaw("Horizontal"); float movement = 0; if (verticalAxis != 0) { movement = verticalAxis; } else if (horizontalAxis != 0) { movement -= horizontalAxis; } if (Input.GetKeyDown(KeyCode.Escape)) { Desactivate(); } if (titleScreenManager.canButtonDown) { if (movement != 0) { titleScreenManager.canButtonDown = false; childSelected -= Mathf.RoundToInt(movement); if (childSelected >= 0 && childSelected < childOptions.Length) { soundModule.playSound(0); } childSelected = Mathf.Clamp(childSelected, 0, childOptions.Length - 1); UpdateChildButtons(); } if (Input.GetKeyDown(KeyCode.Return) || Input.GetKeyDown(KeyCode.Space)) { titleScreenManager.canButtonDown = false; soundModule.playSound(0); ExecuteButton(childSelected); } } } }
// Update is called once per frame void Update() { if (SceneManager.GetActiveScene().name == "End Screen") { if (Input.GetMouseButtonDown(0)) { Invoke(nameof(GoToMenu), 5f); } } float verticalAxis = Input.GetAxisRaw("Vertical"); if (!popUpOpen) { if (canButtonDown) { if (verticalAxis != 0) { canButtonDown = false; buttonPosition -= Mathf.RoundToInt(verticalAxis); if (buttonPosition >= 0 && buttonPosition < boutonMenus.Length) { soundModule.playSound(0); } buttonPosition = Mathf.Clamp(buttonPosition, 0, boutonMenus.Length - 1); UpdateButtons(); } if (Input.GetKeyDown(KeyCode.Return) || Input.GetKeyDown(KeyCode.Space)) { canButtonDown = false; ExecuteButton(buttonPosition); soundModule.playSound(1); } } } if (verticalAxis == 0 && !Input.GetKey(KeyCode.Space) && !Input.GetKey(KeyCode.Return)) { canButtonDown = true; } }