void Update() { // if rotation X is same in two following cycles then face is probably not detected // and pause state can start if (StartManager.pressed) { if (tempRotX == face.getXHeadRotation() || StartManager.boolSeby) { if (!isSendPause) { Object[] objects = FindObjectsOfType(typeof(GameObject)); foreach (GameObject go in objects) { go.SendMessage("OnPauseGame", SendMessageOptions.DontRequireReceiver); } anim.SetTrigger("PauseGame"); isSendPause = true; } else { isSendStart = false; } } else { if (!isSendStart) { anim.SetTrigger("PlayingGame"); Object[] objects = FindObjectsOfType(typeof(GameObject)); foreach (GameObject go in objects) { go.SendMessage("OnResumeGame", SendMessageOptions.DontRequireReceiver); } isSendStart = true; } else { isSendPause = false; } } tempRotX = face.getXHeadRotation(); } }
void Update() { if (axes == RotationAxes.MouseXAndY) { float rotationX = transform.localEulerAngles.y + Input.GetAxis("Mouse X") * sensitivityX; rotationY += Input.GetAxis("Mouse Y") * sensitivityY; rotationY = Mathf.Clamp(rotationY, minimumY, maximumY); transform.localEulerAngles = new Vector3(-rotationY, rotationX, 0); } else if (axes == RotationAxes.MouseX) { transform.Rotate(0, Mathf.Sin(ParseHeadRotationX(face.getXHeadRotation()) * Mathf.PI / 2) * sensitivityX /*Input.GetAxis("Mouse X") * sensitivityX */, 0); } else { rotationY += Input.GetAxis("Mouse Y") * sensitivityY; rotationY = Mathf.Clamp(rotationY, minimumY, maximumY); transform.localEulerAngles = new Vector3(-rotationY, transform.localEulerAngles.y, 0); } }