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()); } } } }