void Update() { if (nextState != State.None) { var horizontal = Input.GetAxis(horizontalInputName); var vertical = Input.GetAxis(verticalInputName); switch (nextState) { case State.Horizontal: if ((IsMatch(horizontal, 1) || IsMatch(horizontal, -1)) && IsMatch(vertical, 0)) { progress += 10 / difficulty; nextState = State.Vertical; } break; case State.Vertical: if (IsMatch(horizontal, 0) && (IsMatch(vertical, 1) || IsMatch(vertical, -1))) { progress += 10 / difficulty; nextState = State.Horizontal; } break; } progress -= decayRate * Time.deltaTime; progress = Mathf.Max(progress, 0); progress = Mathf.Min(progress, 100); } cameraCanvas.UpdatePowerLevel(progress / 100); }