private void UpdateKeyboardRotation(MovementBehavior moveBeh) { moveBeh.StopRotation(); if (Input.GetKey(KeyCode.W)) moveBeh.AddRotation(EDirection.Down); if (Input.GetKey(KeyCode.S)) moveBeh.AddRotation(EDirection.Up); if (Input.GetKey(KeyCode.A)) moveBeh.AddRotation(EDirection.Left); if (Input.GetKey(KeyCode.D)) moveBeh.AddRotation(EDirection.Right); }
private void UpdateMouseRotation(MovementBehavior moveBeh) { moveBeh.StopRotation(); float screenAverage = (Screen.width + Screen.height) / 2; Vector3 screenCenter = new Vector3(Screen.width / 2, Screen.height / 2, 0); Vector3 mouseOffset = (Input.mousePosition - screenCenter) / screenAverage; CameraFollow cammeraFollow = Camera.main.GetComponent<CameraFollow>(); if (Vector3.Distance(Input.mousePosition, screenCenter) > screenAverage * MOUSE_BLIND_AREA_RADIUS) { moveBeh.AddRotation(Quaternion.Euler(0, 0, 90) * mouseOffset * _mouseSensitivity); //cammeraFollow.MouseOffset = mouseOffset; } else { //cammeraFollow.MouseOffset = Vector3.zero; } }