void Update() // * * * * * * * * * * * * * * * * * * Update { if (pauseButtonScript.isPressed()) // . . . . . . . . . . . . Detect pause press and show pause screen { if (paused) { for (int i = 0; i < pauseScreen.Count; i++) { pauseScreen[i].SetActive(false); } paused = false; } else { for (int i = 0; i < pauseScreen.Count; i++) { pauseScreen[i].SetActive(true); } paused = true; } } for (int iJ = 0; iJ < keyJump.Length; iJ++) // . . . . . . . . . . Detect jump trigger { if ((Input.GetKeyDown(keyJump[iJ])) || (screenButtonScript.isPressed())) { bJump = true; } } for (int iR = 0; iR < keyRight.Length; iR++) // . . . . . . . . . . Detect right trigger { if ((Input.GetKey(keyRight[iR])) || (rightButtonScript.isHeld())) { fRight = 1.0f; fLeft = 0.0f; } else { fRight = 0.0f; } } for (int iL = 0; iL < keyLeft.Length; iL++) // . . . . . . . . . . Detect left trigger { if ((Input.GetKey(keyLeft[iL])) || (leftButtonScript.isHeld())) { fLeft = 1.0f; fRight = 0.0f; } else { fLeft = 0.0f; } } if (useTilt) { if ((fLeft == 0.0f) && (fRight == 0.0f)) { float phoneTiltx = Input.acceleration.x * tiltSpeed; // . . . . . . . . . . Tilt controls float phoneTilty = -Input.acceleration.x * tiltSpeed; if (fLeft == 0.0f) { if (phoneTiltx > tiltDeadzone) { fRight = phoneTiltx; } } if (fRight == 0.0f) { if (phoneTilty > tiltDeadzone) { fLeft = phoneTilty; } } } } }