Inheritance: MonoBehaviour
Ejemplo n.º 1
0
            static bool Prefix(ref CustomMouseLook __instance, Transform character, Transform camera)
            {
                MouseLook.LookRotation(ref __instance, character, camera);

                return(false);
                //return true;
            }
Ejemplo n.º 2
0
 void Start()
 {
     IsOverheating = false;
     Temperature   = 0f;
     look          = GetComponentInParent <CustomMouseLook>();
     player        = (AbstractPlayer)GameManager.instance.CurrentPlayer;
 }
Ejemplo n.º 3
0
 void Awake()
 {
     camera = GameObject.Find ("Main Camera");
     mouseLook = camera.GetComponent <CustomMouseLook>();
     pauseMenu = GameObject.Find ("PauseMenu");
     settingsMenu = GameObject.Find ("SettingsMenu");
     Keybinds = GameObject.Find ("KeybindsManager").GetComponent<Keybinds> ();
 }
Ejemplo n.º 4
0
 void Awake()
 {
     camera       = GameObject.Find("Main Camera");
     mouseLook    = camera.GetComponent <CustomMouseLook>();
     pauseMenu    = GameObject.Find("PauseMenu");
     settingsMenu = GameObject.Find("SettingsMenu");
     Keybinds     = GameObject.Find("KeybindsManager").GetComponent <Keybinds> ();
 }
Ejemplo n.º 5
0
            public static void LookRotation(ref CustomMouseLook __instance, Transform character, Transform camera)
            {
                if (!__instance.m_cursorIsLocked)
                {
                    return;
                }

                Vector2 mouseRAW = new Vector2(Input.GetAxisRaw("Mouse X"), Input.GetAxisRaw("Mouse Y"));

                if (mouseMov.x * mouseRAW.x < 0)
                {
                    mouseAcc.x = 0;
                }
                if (mouseMov.y * mouseRAW.y < 0)
                {
                    mouseAcc.y = 0;
                }

                mouseMov = mouseRAW * __instance.XSensitivity;

                float dmpFac = 5 * settings.dmpMul;
                float dmpAcc = dmpFac * (Input.GetKey(KeyCode.Mouse1) ? 0.2f : 0.9f);
                float dmpBrk = dmpFac * 2 * (Input.GetKey(KeyCode.Mouse1) ? 0.5f : 0.7f);

                mouseAcc = new Vector2(
                    Mathf.Lerp(mouseAcc.x, mouseMov.x, Mathf.Abs(mouseAcc.x) > Mathf.Abs(mouseMov.x) ? dmpBrk : dmpAcc * Time.deltaTime),
                    Mathf.Lerp(mouseAcc.y, mouseMov.y, Mathf.Abs(mouseAcc.y) > Mathf.Abs(mouseMov.y) ? dmpBrk : dmpAcc * Time.deltaTime));

                float xMov = enabled
                                        ? mouseAcc.x * __instance.sensitivityMultiplier
                                        : Input.GetAxis("Mouse X") * __instance.XSensitivity * __instance.sensitivityMultiplier;
                float yMov = enabled
                                        ? mouseAcc.y * __instance.sensitivityMultiplier
                                        : Input.GetAxis("Mouse Y") * __instance.YSensitivity * __instance.sensitivityMultiplier;

                if (__instance.invertyMouseY)
                {
                    yMov *= -1;
                }

                __instance.m_CharacterTargetRot  = ((character.parent != null) ? character.localRotation : Quaternion.Euler(0f, character.eulerAngles.y, 0f));
                __instance.m_CharacterTargetRot *= Quaternion.Euler(0f, xMov, 0f);
                __instance.m_CameraTargetRot    *= Quaternion.Euler(0f - yMov, 0f, 0f);
                if (__instance.clampVerticalRotation)
                {
                    __instance.m_CameraTargetRot = __instance.ClampRotationAroundXAxis(__instance.m_CameraTargetRot);
                }
                character.localRotation = (__instance.cameraHolder.localRotation = __instance.m_CharacterTargetRot);
                camera.localRotation    = __instance.m_CameraTargetRot * __instance.cameraAnchor.localRotation;
            }
Ejemplo n.º 6
0
 // Use this for initialization
 void Start()
 {
     Cursor.lockState = CursorLockMode.Locked;
     character        = GetComponent <Rigidbody>();
     mouseLook        = GetComponent <CustomMouseLook>();
     rotator          = GetComponent <CharacterRotator>();
     sMovement        = GetComponent <SurfaceMovement>();
     grappleGun       = GetComponent <GrappleGun>();
     if (grappleGun)
     {
         grappleGun.controller = this;
     }
     grappled  = false;
     justFired = false;
 }
Ejemplo n.º 7
0
 // Use this for initialization
 void Start()
 {
     Cursor.lockState = CursorLockMode.Locked;
     character = GetComponent<Rigidbody>();
     mouseLook = GetComponent<CustomMouseLook>();
     rotator = GetComponent<CharacterRotator>();
     sMovement = GetComponent<SurfaceMovement>();
     grappleGun = GetComponent<GrappleGun>();
     if (grappleGun) grappleGun.controller = this;
     grappled = false;
     justFired = false;
 }
Ejemplo n.º 8
0
 void Start()
 {
     IsOverheating = false;
     Temperature = 0f;
     look = GetComponentInParent<CustomMouseLook>();
     player = (AbstractPlayer)GameManager.instance.CurrentPlayer;
 }