void OnGUI() { if (GUILayout.Button(String.Format("Gyro {0}", GyroInput.getInstance().getTilt()))) { Debug.Log("Hello!"); } }
// Update is called once per frame void Update() { DontLeaveEarth(); if (playerState == PlayerState.None) { if (Input.GetMouseButtonDown(0)) { StartMoving(); } } if (playerState == PlayerState.StartStairs) { transform.Translate(new Vector3(0, 1, 0) * speed * Time.deltaTime); timer += Time.deltaTime; trailTimer += Time.deltaTime; if (trailTimer > timeToSpawnTrail) { SpawnTrail(); trailTimer = 0; } if (timer > timeToNextState) { MoveDone(); } } if (playerState == PlayerState.Listening) { timer += Time.deltaTime; Debug.Log(timer + ":" + timeToNextState); if (timer > timeToNextState) { Debug.Log("Listen Done"); VA_AudioSource[] sources = GameObject.FindObjectsOfType <VA_AudioSource>(); for (int i = 0; i < sources.Length; i++) { sources[i].BaseVolume *= 4f; } playerState = PlayerState.None; HideScreen(); } } rotation = rotation * rotationSpeed; transform.eulerAngles = new Vector3(transform.eulerAngles.x, transform.eulerAngles.y, ClampAngle(rotation * range, -range, range)); float horizontal = GyroInput.getInstance().getTilt(); horizontal = Mathf.Clamp(horizontal, -1, 1); UpdateRotation(horizontal); }