void Update() { bool isLeft = Input.GetKey(KeyCode.Mouse0); bool rKey = Input.GetKeyDown(KeyCode.R); bool gKey = Input.GetKeyDown(KeyCode.G); bool isB = WiiMote.wiimote_getButtonB(Configuration.pointerWiiMote); bool isA = WiiMote.wiimote_getButtonA(Configuration.pointerWiiMote); bool isBtnLeft = WiiMote.wiimote_getButtonLeft(Configuration.pointerWiiMote); bool isBtnRight = WiiMote.wiimote_getButtonRight(Configuration.pointerWiiMote); oldPos = this.transform.position; Vector3 newPos = originalPos + receivedPos; if (newPos.x > 13 || newPos.x < -11f) { newPos.x = oldPos.x; } newPos.y += 1; if (newPos.y < 0.5f) { newPos.y += 0.5f - newPos.y; } if (newPos.z > 82 || newPos.z < 42) { newPos.z = oldPos.z; } this.transform.position = newPos; if (imageEffectActive) { checkCameraDistort(); } if (isLeft || isB) { weapon.shoot(); } if (rKey || isA) { reloadWeapon(); } if (gKey || isBtnLeft || isBtnRight) { cambioArma(); } }
void Update() { bool downBtn = WiiMote.wiimote_getButtonDown(Configuration.pointerWiiMote); bool upBtn = WiiMote.wiimote_getButtonUp(Configuration.pointerWiiMote); bool isA = WiiMote.wiimote_getButtonA(Configuration.pointerWiiMote); bool downKey = Input.GetKey(KeyCode.DownArrow); bool upKey = Input.GetKey(KeyCode.UpArrow); bool enterKey = Input.GetKey(KeyCode.Return); bool backKey = Input.GetKey(KeyCode.Backspace); bool buttonB = WiiMote.wiimote_getButtonB(Configuration.pointerWiiMote); if (backKey && !isRoot || buttonB && !isRoot) { Configuration.saveConfig(); navigateTo(backMenu); } buttonDownTimer += Time.deltaTime; if (downBtn || downKey) { if (buttonDownTimer >= 0.2f) { if (selectedButton + 1 <= buttons.Length) { for (int i = 0; i < buttons.Length; i++) { if (usesShader) { buttons[i].renderer.material.shader = originalShader; } else { buttons[i].renderer.material.color = originalColor; } } selectedButton++; if (usesShader) { buttons[selectedButton - 1].renderer.material.shader = glowShader; } else { buttons[selectedButton - 1].renderer.material.color = glowColor; } buttonDownTimer = 0f; } } } if (upBtn || upKey) { if (buttonDownTimer >= 0.2f) { if (selectedButton > 1) { for (int i = 0; i < buttons.Length; i++) { if (usesShader) { buttons[i].renderer.material.shader = originalShader; } else { buttons[i].renderer.material.color = originalColor; } } selectedButton--; if (usesShader) { buttons[selectedButton - 1].renderer.material.shader = glowShader; } else { buttons[selectedButton - 1].renderer.material.color = glowColor; } buttonDownTimer = 0f; } } } if (isA || enterKey) { if (accessible) { if (buttons[selectedButton - 1].GetComponent <Menu>().checkButton() != null) { navigateTo(buttons[selectedButton - 1].GetComponent <Menu>().checkButton()); } } } }
public void selectOption() { bool isUp = Input.GetKeyDown(KeyCode.UpArrow); bool isDown = Input.GetKeyDown(KeyCode.DownArrow); bool isEnter = Input.GetKeyDown(KeyCode.Return); bool isWiiDown = WiiMote.wiimote_getButtonDown(Configuration.pointerWiiMote); bool isWiiUp = WiiMote.wiimote_getButtonUp(Configuration.pointerWiiMote); bool isWiiA = WiiMote.wiimote_getButtonA(Configuration.pointerWiiMote); if (isEnter || isWiiA) { switch (menuNavigator) { case 1: pauseCheck = false; pauseGame(); break; case 2: optionsContainer.SetActive(true); resizeOptionsGui(); openOptionMenu(); menuNavigator = 7; pointerOption.material.color = normalOpacity; break; case 3: StartCoroutine(RoundManager.dbController.PostScores(PlayerBehave.playerName, PlayerBehave.score)); pauseGame(); Round.number = 0; Time.timeScale = 1f; this.GetComponent <TCP>().closeConnection(); Application.LoadLevel(0); break; case 4: Time.timeScale = 1f; pauseGame(); this.GetComponent <TCP>().closeConnection(); Application.LoadLevel(0); break; case 5: Application.Quit(); break; } } //navegar con flechitas if (isUp || letUp || isWiiUp) { menuNavigator -= 1; switch (menuNavigator) { case 0: menuNavigator = 5; resume.material.color = lowOpacity; exitToWindows.material.color = normalOpacity; break; case 1: resume.material.color = normalOpacity; options.material.color = lowOpacity; break; case 2: options.material.color = normalOpacity; saveAndExit.material.color = lowOpacity; break; case 3: exitToMenu.material.color = lowOpacity; saveAndExit.material.color = normalOpacity; break; case 4: exitToWindows.material.color = lowOpacity; exitToMenu.material.color = normalOpacity; break; case 5: resume.material.color = lowOpacity; exitToWindows.material.color = normalOpacity; break; case 6: menuNavigator = 10; pointerOption.material.color = lowOpacity; goBack.material.color = normalOpacity; break; case 7: pointerOption.material.color = normalOpacity; cameraOption.material.color = lowOpacity; break; case 8: difficultyOption.material.color = lowOpacity; cameraOption.material.color = normalOpacity; break; case 9: difficultyOption.material.color = normalOpacity; goBack.material.color = lowOpacity; break; case 10: goBack.material.color = normalOpacity; break; } } if (isDown || isWiiDown) { menuNavigator += 1; switch (menuNavigator) { case 1: resume.material.color = normalOpacity; exitToWindows.material.color = lowOpacity; break; case 2: resume.material.color = lowOpacity; options.material.color = normalOpacity; break; case 3: options.material.color = lowOpacity; saveAndExit.material.color = normalOpacity; break; case 4: saveAndExit.material.color = lowOpacity; exitToMenu.material.color = normalOpacity; break; case 5: exitToMenu.material.color = lowOpacity; exitToWindows.material.color = normalOpacity; break; case 6: menuNavigator = 1; resume.material.color = normalOpacity; exitToWindows.material.color = lowOpacity; break; case 7: pointerOption.material.color = normalOpacity; goBack.material.color = lowOpacity; break; case 8: pointerOption.material.color = lowOpacity; cameraOption.material.color = normalOpacity; break; case 9: cameraOption.material.color = lowOpacity; difficultyOption.material.color = normalOpacity; break; case 10: difficultyOption.material.color = lowOpacity; goBack.material.color = normalOpacity; break; case 11: menuNavigator = 7; goBack.material.color = lowOpacity; pointerOption.material.color = normalOpacity; break; } } //navegar con flechitas }