예제 #1
0
        private void Update()
        {
            if (MakerOptimization.ManageCursor.Value && Application.isFocused)
            {
                if (!cursorLocked)
                {
                    if (GUIUtility.hotControl == 0 && !EventSystem.current.IsPointerOverGameObject())
                    {
                        bool mouseDown0 = Input.GetMouseButtonDown(0);
                        bool mouseDown1 = Input.GetMouseButtonDown(1);

                        if (mouseDown0 || mouseDown1)
                        {
                            if (mouseDown0)
                            {
                                mouseButtonDown0 = true;
                            }
                            if (mouseDown1)
                            {
                                mouseButtonDown1 = true;
                            }

                            Cursor.visible   = false;
                            Cursor.lockState = CursorLockMode.Confined;
                            cursorLocked     = true;
                            WinCursor.GetCursorPos(out lockPos);
                        }
                    }
                }

                if (cursorLocked)
                {
                    bool mouseUp0 = Input.GetMouseButtonUp(0);
                    bool mouseUp1 = Input.GetMouseButtonUp(1);

                    if ((mouseButtonDown0 || mouseButtonDown1) && (mouseUp0 || mouseUp1))
                    {
                        if (mouseUp0)
                        {
                            mouseButtonDown0 = false;
                        }
                        if (mouseUp1)
                        {
                            mouseButtonDown1 = false;
                        }

                        if (!mouseButtonDown0 && !mouseButtonDown1)
                        {
                            Cursor.lockState = CursorLockMode.None;
                            Cursor.visible   = true;
                            cursorLocked     = false;
                        }
                    }

                    if (cursorLocked)
                    {
                        WinCursor.SetCursorPos(lockPos.x, lockPos.y);
                    }
                }
            }
            else if (cursorLocked)
            {
                Cursor.lockState = CursorLockMode.None;
                Cursor.visible   = true;
                cursorLocked     = false;
            }
        }
예제 #2
0
        public void FinalizeLevelLoadNew()
        {
            if (((this.CurrentMap != null) && !this.CurrentMap.HasBeenVisited) && ((BonusXpManager.Instance != null) && this.CurrentMap.GivesExplorationXp))
            {
                this.CurrentMap.HasBeenVisited = true;
                int xp = 0;
                if (BonusXpManager.Instance != null)
                {
                    xp = BonusXpManager.Instance.MapExplorationXp;
                }
                object[] parameters = new object[] { this.CurrentMap.DisplayName, xp *PartyHelper.NumPartyMembers };
                global::Console.AddMessage("[" + NGUITools.EncodeColor(Color.yellow) + "]" + global::Console.Format(GUIUtils.GetTextWithLinks(0x661), parameters));
                PartyHelper.AssignXPToParty(xp, false);
            }
            if (OnLevelLoaded != null)
            {
                OnLevelLoaded(Application.loadedLevelName, EventArgs.Empty);
            }
            if (NewGame && (this.Difficulty == GameDifficulty.Easy))
            {
                Option.AutoPause.SetSlowEvent(AutoPauseOptions.PauseEvent.CombatStart, true);
            }
            ScriptEvent.BroadcastEvent(ScriptEvent.ScriptEvents.OnLevelLoaded);
            IsLoading = false;
            if (((s_playerCharacter != null) && !LoadedGame) && (!NewGame && (NumSceneLoads > 0)))
            {
                if (!IEModOptions.SaveBeforeTransition)                 // added this line
                {
                    if (FogOfWar.Instance)
                    {
                        FogOfWar.Instance.WaitForFogUpdate();
                    }
                    AutosaveIfAllowed();
                }
            }
            NewGame = false;
            if (((this.CurrentMap != null) && (this.CouldCampOnLastMap != this.CurrentMap.CanCamp)) && !Option.GetOption(GameOption.BoolOption.DONT_RESTRICT_STASH))
            {
                if (this.CurrentMap.CanCamp)
                {
                    UISystemMessager.Instance.PostMessage(GUIUtils.GetText(0x61e), Color.white);
                }
                else
                {
                    UISystemMessager.Instance.PostMessage(GUIUtils.GetText(0x61d), Color.white);
                }
            }
            NumSceneLoads++;
            FatigueCamera.CreateCamera();
            GammaCamera.CreateCamera();
            WinCursor.Clip(true);

            // in here you can place something like if (CurrentMap.SceneName == "AR_0011_Dyrford_Tavern_02") make_an_NPC; or change_NPC's_stats;
            // added this code
            mod_CommandLine.InjectDropInvButton();

            if (PlayerPrefs.GetInt("UseCustomUi", 0) == 1 && PlayerPrefs.GetInt("AppliedCustomUi", 0) == 0)
            {
                Debug.Log("P! start if block");
                mod_CommandLine.CustomUiApplyOnce();
                PlayerPrefs.SetInt("AppliedCustomUi", 1);
                mod_CommandLine.RepositionUi();
            }

            if (IEModOptions.FixBackerNames)
            {
                mod_CommandLine.FixBackerNames(true);
            }
            else
            {
                mod_CommandLine.FixBackerNames(false);
            }
            // end of added code
        }
예제 #3
0
        public void mod_FinalizeLevelLoad()
        {
            try
            {
                if (this.CurrentMap != null && !this.CurrentMap.HasBeenVisited && BonusXpManager.Instance && this.CurrentMap.GivesExplorationXp)
                {
                    this.CurrentMap.HasBeenVisited = true;
                    int mapExplorationXp = 0;
                    if (BonusXpManager.Instance != null)
                    {
                        mapExplorationXp = BonusXpManager.Instance.MapExplorationXp;
                    }
                    Console.AddMessage(string.Concat("[", NGUITools.EncodeColor(Color.yellow), "]", Console.Format(GUIUtils.GetTextWithLinks(1633), new object[] { this.CurrentMap.DisplayName, mapExplorationXp * PartyHelper.NumPartyMembers })));
                    PartyHelper.AssignXPToParty(mapExplorationXp, false);
                }
                if (GameState.OnLevelLoaded != null)
                {
                    GameState.OnLevelLoaded(Application.loadedLevelName, EventArgs.Empty);
                }
                if (GameState.NewGame && this.Difficulty == GameDifficulty.Easy)
                {
                    GameState.Option.AutoPause.SetSlowEvent(AutoPauseOptions.PauseEvent.CombatStart, true);
                }
                ScriptEvent.BroadcastEvent(ScriptEvent.ScriptEvents.OnLevelLoaded);
                GameState.IsLoading = false;
                if (GameState.s_playerCharacter != null && !GameState.LoadedGame && !GameState.NewGame && GameState.NumSceneLoads > 0)
                {
                    if (!IEModOptions.SaveBeforeTransition) // added this line
                    {
                        if (FogOfWar.Instance)
                        {
                            FogOfWar.Instance.WaitForFogUpdate();
                        }
                        AutosaveIfAllowed();
                    }
                }
                GameState.NewGame = false;
                if (this.CurrentMap != null && this.CouldAccessStashOnLastMap != this.CurrentMap.GetCanAccessStash() && !GameState.Option.GetOption(GameOption.BoolOption.DONT_RESTRICT_STASH))
                {
                    if (!this.CurrentMap.GetCanAccessStash())
                    {
                        UISystemMessager.Instance.PostMessage(GUIUtils.GetText(1566), Color.white);
                    }
                    else
                    {
                        UISystemMessager.Instance.PostMessage(GUIUtils.GetText(1565), Color.white);
                    }
                }
                GameState.NumSceneLoads = GameState.NumSceneLoads + 1;
                FatigueCamera.CreateCamera();
                GammaCamera.CreateCamera();
                WinCursor.Clip(true);
                if (this.CurrentMap != null)
                {
                    TutorialManager.TutorialTrigger tutorialTrigger = new TutorialManager.TutorialTrigger(TutorialManager.TriggerType.ENTERED_MAP)
                    {
                        Map = this.CurrentMap.SceneName
                    };
                    TutorialManager.STriggerTutorialsOfType(tutorialTrigger);
                }
                if (this.CurrentMap != null && this.CurrentMap.IsValidOnMap("px1"))
                {
                    GameState.Instance.HasEnteredPX1 = true;
                    if (GameGlobalVariables.HasStartedPX2())
                    {
                        this.HasEnteredPX2 = true;
                    }
                }
                // in here you can place something like if (CurrentMap.SceneName == "AR_0011_Dyrford_Tavern_02") make_an_NPC; or change_NPC's_stats;
                // added this code

                // Addition of autoload custom NPC stats if enabled
                if (IEModOptions.AutoLoadCustomStats)
                {
                    ImportStats();
                }

                DropButton.InjectDropInvButton();
                if (IEModOptions.EnableCustomUi)
                {
                    if (IEModOptions.Layout == null)
                    {
                        UICustomizer.Initialize();
                        IEModOptions.Layout = UICustomizer.DefaultLayout.Clone();
                    }
                    else
                    {
                        UICustomizer.LoadLayout(IEModOptions.Layout);
                    }
                }

                BackerNamesMod.FixBackerNames(IEModOptions.FixBackerNames);
            }
            catch (Exception exception)
            {
                Debug.LogException(exception);
                GameState.ReturnToMainMenuFromError();
            }
            if (!this.RetroactiveSpellMasteryChecked)
            {
                for (int i = 0; i < (int)PartyMemberAI.PartyMembers.Length; i++)
                {
                    if (PartyMemberAI.PartyMembers[i] != null)
                    {
                        CharacterStats component = PartyMemberAI.PartyMembers[i].GetComponent <CharacterStats>();
                        if (component)
                        {
                            if (component.MaxMasteredAbilitiesAllowed() > component.GetNumMasteredAbilities())
                            {
                                UIWindowManager.ShowMessageBox(UIMessageBox.ButtonStyle.OK, GUIUtils.GetText(2252), GUIUtils.GetText(2303));
                                break;
                            }
                        }
                    }
                }
                this.RetroactiveSpellMasteryChecked = true;
            }
            if (GameUtilities.HasPX2() && GameState.LoadedGame)
            {
                if (GameGlobalVariables.HasFinishedPX1())
                {
                    QuestManager.Instance.StartPX2Umbrella();
                }
                else if (!this.HasNotifiedPX2Installation)
                {
                    UIWindowManager.ShowMessageBox(UIMessageBox.ButtonStyle.OK, string.Empty, GUIUtils.GetText(2438));
                    this.HasNotifiedPX2Installation = true;
                }
            }
        }
예제 #4
0
        protected virtual void Update()
        {
            Hotkey.inputFieldSelected = InputFieldSelected;
            targetManager.UpdateCustomTargetTransforms();
            GamepadControls();

            lockOnHotkey.KeyHoldAction(LockOnRelease);
            lockOnHotkey.KeyUpAction(() => LockOn());
            lockOnGuiHotkey.KeyDownAction(ToggleLockOnGUI);
            prevCharaHotkey.KeyDownAction(() => CharaSwitch(false));
            nextCharaHotkey.KeyDownAction(() => CharaSwitch(true));
            //rotationHotkey.KeyDownAction(ToggleRotationLock);

            if (lockOnTarget)
            {
                if (Input.GetMouseButton(0) && Input.GetMouseButton(1))
                {
                    float x = Input.GetAxis("Mouse X");
                    float y = Input.GetAxis("Mouse Y");
                    if (Mathf.Abs(x) > 0f || Mathf.Abs(y) > 0f)
                    {
                        targetOffsetSize += (CameraRight * x * defaultCameraSpeed) + (CameraForward * y * defaultCameraSpeed);
                        reduceOffset      = false;
                    }
                }
                else if (Input.GetMouseButton(1))
                {
                    float x = Input.GetAxis("Mouse X");
                    if (Input.GetKey(KeyCode.LeftControl))
                    {
                        Guitime.angle = 0.1f;
                        if (Mathf.Abs(x) > 0f)
                        {
                            //camera tilt adjustment
                            float newAngle = CameraAngle.z - x;
                            newAngle    = Mathf.Repeat(newAngle, 360f);
                            CameraAngle = new Vector3(CameraAngle.x, CameraAngle.y, newAngle);
                        }
                    }
                    else if (Input.GetKey(KeyCode.LeftShift))
                    {
                        Guitime.fov = 0.1f;
                        if (Mathf.Abs(x) > 0f)
                        {
                            //fov adjustment
                            float newFov = CameraFov + x;
                            CameraFov = Mathf.Clamp(newFov, 1f, 160f);
                        }
                    }
                    else if (!InputFieldSelected)
                    {
                        if (Mathf.Abs(x) > 0f)
                        {
                            //handle zooming manually when camera.movespeed == 0
                            float newDir = CameraDir.z - x * CameraZoomSpeed;
                            newDir       = Mathf.Clamp(newDir, float.MinValue, 0f);
                            CameraDir    = new Vector3(0f, 0f, newDir);
                            reduceOffset = false;
                        }

                        float y = Input.GetAxis("Mouse Y");
                        if (Mathf.Abs(y) > 0f)
                        {
                            targetOffsetSize += (Vector3.up * y * defaultCameraSpeed);
                            reduceOffset      = false;
                        }
                    }
                }

                bool RightArrow = Input.GetKey(KeyCode.RightArrow), LeftArrow = Input.GetKey(KeyCode.LeftArrow);
                bool UpArrow = Input.GetKey(KeyCode.UpArrow), DownArrow = Input.GetKey(KeyCode.DownArrow);
                bool PageUp = Input.GetKey(KeyCode.PageUp), PageDown = Input.GetKey(KeyCode.PageDown);

                if (!InputFieldSelected && Hotkey.allowHotkeys && (RightArrow || LeftArrow || UpArrow || DownArrow || PageUp || PageDown))
                {
                    reduceOffset   = false;
                    offsetKeyHeld += Time.deltaTime / 3f;
                    if (offsetKeyHeld > 1f)
                    {
                        offsetKeyHeld = 1f;
                    }
                    float speed = Time.deltaTime * Mathf.Lerp(0.2f, 2f, offsetKeyHeld);

                    if (RightArrow)
                    {
                        targetOffsetSize += CameraRight * speed;
                    }
                    else if (LeftArrow)
                    {
                        targetOffsetSize += CameraRight * -speed;
                    }

                    if (UpArrow)
                    {
                        targetOffsetSize += CameraForward * speed;
                    }
                    else if (DownArrow)
                    {
                        targetOffsetSize += CameraForward * -speed;
                    }

                    if (PageUp)
                    {
                        targetOffsetSize += CameraUp * speed;
                    }
                    else if (PageDown)
                    {
                        targetOffsetSize += CameraUp * -speed;
                    }
                }
                else
                {
                    offsetKeyHeld -= Time.deltaTime * 2f;
                    if (offsetKeyHeld < 0f)
                    {
                        offsetKeyHeld = 0f;
                    }
                }

                if (reduceOffset)
                {
                    if (targetOffsetSize.magnitude > 0.00001f)
                    {
                        float trackingSpeed = (lockRotation && trackingSpeedNormal < trackingSpeedRotation) ? trackingSpeedRotation : trackingSpeedNormal;
                        targetOffsetSize = Vector3.MoveTowards(targetOffsetSize, new Vector3(), targetOffsetSize.magnitude / (1f / trackingSpeed));
                    }
                    else
                    {
                        targetOffsetSize = new Vector3();
                        reduceOffset     = false;
                    }
                }

                if (AllowTracking)
                {
                    float trackingSpeed;
                    if (lockOnTarget.name == CameraTargetManager.MOVEMENTPOINT_NAME)
                    {
                        trackingSpeed = 0.3f;
                    }
                    else
                    {
                        trackingSpeed = (lockRotation && trackingSpeedNormal < trackingSpeedRotation) ? trackingSpeedRotation : trackingSpeedNormal;
                    }
                    float distance = Vector3.Distance(CameraTargetPos, lastTargetPos.Value);
                    if (distance > 0.00001f)
                    {
                        CameraTargetPos = Vector3.MoveTowards(CameraTargetPos, LockOnTargetPos + targetOffsetSize, distance * trackingSpeed * Time.deltaTime * 60f);
                    }
                    CameraTargetPos      += targetOffsetSize - targetOffsetSizeAdded;
                    targetOffsetSizeAdded = targetOffsetSize;
                    lastTargetPos         = LockOnTargetPos + targetOffsetSize;
                }
            }

            //if(lockRotation)
            //{
            //    Vector3 targetAngle = CameraAdjustedEulerAngles(lockOnTarget, CameraTransform);
            //    Vector3 difference = targetAngle - lastTargetAngle;
            //    CameraAngle += new Vector3(-difference.x, -difference.y, -difference.z);
            //    lastTargetAngle = targetAngle;
            //}

            if (Input.GetKeyDown(KeyCode.Escape))
            {
                showLockOnTargets = false;
            }

            if (manageCursorVisibility)
            {
                if (!cursorLocked)
                {
                    if (GUIUtility.hotControl == 0 && !EventSystem.current.IsPointerOverGameObject() && Hotkey.allowHotkeys)
                    {
                        if (Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1))
                        {
                            if (Input.GetMouseButtonDown(0))
                            {
                                mouseButtonDown0 = true;
                            }
                            if (Input.GetMouseButtonDown(1))
                            {
                                mouseButtonDown1 = true;
                            }

                            Cursor.visible   = false;
                            Cursor.lockState = CursorLockMode.Confined;

                            cursorLocked = true;
                            WinCursor.GetCursorPos(out lockPos);
                        }
                    }
                }

                if (cursorLocked)
                {
                    if ((mouseButtonDown0 || mouseButtonDown1) && (Input.GetMouseButtonUp(0) || Input.GetMouseButtonUp(1)))
                    {
                        if (Input.GetMouseButtonUp(0))
                        {
                            mouseButtonDown0 = false;
                        }
                        if (Input.GetMouseButtonUp(1))
                        {
                            mouseButtonDown1 = false;
                        }

                        if (!mouseButtonDown0 && !mouseButtonDown1)
                        {
                            Cursor.lockState = CursorLockMode.None;
                            Cursor.visible   = true;
                            cursorLocked     = false;
                        }
                    }

                    if (cursorLocked)
                    {
                        WinCursor.SetCursorPos(lockPos.x, lockPos.y);
                    }
                }
            }
        }
예제 #5
0
        public void mod_FinalizeLevelLoad()
        {
            if (this.CurrentMap != null && !this.CurrentMap.HasBeenVisited && BonusXpManager.Instance &&
                this.CurrentMap.GivesExplorationXp)
            {
                this.CurrentMap.HasBeenVisited = true;
                int xp = 0;
                if (BonusXpManager.Instance != null)
                {
                    xp = BonusXpManager.Instance.MapExplorationXp;
                }
                object[] parameters = new object[] {
                    this.CurrentMap.DisplayName,
                    xp *PartyHelper.NumPartyMembers
                };
                global::Console.AddMessage("[" + NGUITools.EncodeColor(Color.yellow) + "]"
                                           + global::Console.Format(GUIUtils.GetTextWithLinks(0x661), parameters));
                PartyHelper.AssignXPToParty(xp, false);
            }
            if (OnLevelLoaded != null)
            {
                OnLevelLoaded(Application.loadedLevelName, EventArgs.Empty);
            }
            if (NewGame && (this.Difficulty == GameDifficulty.Easy))
            {
                Option.AutoPause.SetSlowEvent(AutoPauseOptions.PauseEvent.CombatStart, true);
            }
            ScriptEvent.BroadcastEvent(ScriptEvent.ScriptEvents.OnLevelLoaded);
            GameState.IsLoading = false;
            if (GameState.s_playerCharacter != null && !GameState.LoadedGame && !GameState.NewGame && GameState.NumSceneLoads > 0)
            {
                if (!IEModOptions.SaveBeforeTransition)                 // added this line
                {
                    if (FogOfWar.Instance)
                    {
                        FogOfWar.Instance.WaitForFogUpdate();
                    }
                    AutosaveIfAllowed();
                }
            }
            NewGame = false;
            if (((this.CurrentMap != null) && (this.CouldCampOnLastMap != this.CurrentMap.CanCamp)) &&
                !Option.GetOption(GameOption.BoolOption.DONT_RESTRICT_STASH))
            {
                if (this.CurrentMap.CanCamp)
                {
                    UISystemMessager.Instance.PostMessage(GUIUtils.GetText(0x61e), Color.white);
                }
                else
                {
                    UISystemMessager.Instance.PostMessage(GUIUtils.GetText(0x61d), Color.white);
                }
            }
            NumSceneLoads++;
            FatigueCamera.CreateCamera();
            GammaCamera.CreateCamera();
            WinCursor.Clip(true);
            if (this.CurrentMap != null)
            {
                TutorialManager.TutorialTrigger trigger =
                    new TutorialManager.TutorialTrigger(TutorialManager.TriggerType.ENTERED_MAP);
                trigger.Map = this.CurrentMap.SceneName;
                TutorialManager.STriggerTutorialsOfType(trigger);
            }
            if (this.CurrentMap != null && this.CurrentMap.IsValidOnMap("px1"))
            {
                GameState.Instance.HasEnteredPX1 = true;
            }
            // in here you can place something like if (CurrentMap.SceneName == "AR_0011_Dyrford_Tavern_02") make_an_NPC; or change_NPC's_stats;
            // added this code
            DropButton.InjectDropInvButton();
            if (IEModOptions.EnableCustomUi)
            {
                if (IEModOptions.Layout == null)
                {
                    UICustomizer.Initialize();
                    IEModOptions.Layout = UICustomizer.DefaultLayout.Clone();
                }
                else
                {
                    UICustomizer.LoadLayout(IEModOptions.Layout);
                }
            }



            BackerNamesMod.FixBackerNames(IEModOptions.FixBackerNames);
            // end of added code
        }
예제 #6
0
        protected virtual void Update()
        {
            if (!lockOnTarget && lockedOn)
            {
                Console.WriteLine("[{0}] Reset mod state", NAME_HSCENEMAKER);
                ResetModState();
            }

            GamepadControls();
            lockOnHotkey.KeyHoldAction(LockOnRelease);
            lockOnHotkey.KeyUpAction(() => LockOn());
            lockOnGuiHotkey.KeyDownAction(ToggleLockOnGUI);
            prevCharaHotkey.KeyDownAction(() => CharaSwitch(false));
            nextCharaHotkey.KeyDownAction(() => CharaSwitch(true));

            if (lockOnTarget && CameraEnabled)
            {
                if (Input.GetMouseButton(0) && Input.GetMouseButton(1))
                {
                    float x = Input.GetAxis("Mouse X");
                    float y = Input.GetAxis("Mouse Y");
                    if (Mathf.Abs(x) > 0f || Mathf.Abs(y) > 0f)
                    {
                        targetOffsetSize += (CameraRight * x * defaultCameraSpeed) + (CameraForward * y * defaultCameraSpeed);
                        reduceOffset      = false;
                    }
                }
                else if (Input.GetMouseButton(1))
                {
                    float x = Input.GetAxis("Mouse X");
                    if (Input.GetKey(KeyCode.LeftControl))
                    {
                        Guitime.angle = 0.1f;
                        if (Mathf.Abs(x) > 0f)
                        {
                            //camera tilt adjustment
                            float newAngle = CameraAngle.z - x;
                            newAngle    = Mathf.Repeat(newAngle, 360f);
                            CameraAngle = new Vector3(CameraAngle.x, CameraAngle.y, newAngle);
                        }
                    }
                    else if (Input.GetKey(KeyCode.LeftShift))
                    {
                        Guitime.fov = 0.1f;
                        if (Mathf.Abs(x) > 0f)
                        {
                            //fov adjustment
                            float newFov = CameraFov + x;
                            CameraFov = Mathf.Clamp(newFov, 1f, 160f);
                        }
                    }
                    else if (!InputFieldSelected)
                    {
                        if (Mathf.Abs(x) > 0f)
                        {
                            //handle zooming manually when camera.movespeed == 0
                            float newDir = CameraDir.z - x * CameraZoomSpeed;
                            newDir       = Mathf.Clamp(newDir, float.MinValue, 0f);
                            CameraDir    = new Vector3(0f, 0f, newDir);
                            reduceOffset = false;
                        }

                        float y = Input.GetAxis("Mouse Y");
                        if (Mathf.Abs(y) > 0f)
                        {
                            targetOffsetSize += (Vector3.up * y * defaultCameraSpeed);
                            reduceOffset      = false;
                        }
                    }
                }

                bool RightArrow = Input.GetKey(KeyCode.RightArrow), LeftArrow = Input.GetKey(KeyCode.LeftArrow);
                bool UpArrow = Input.GetKey(KeyCode.UpArrow), DownArrow = Input.GetKey(KeyCode.DownArrow);
                bool PageUp = Input.GetKey(KeyCode.PageUp), PageDown = Input.GetKey(KeyCode.PageDown);

                if (!InputFieldSelected && Hotkey.allowHotkeys && (RightArrow || LeftArrow || UpArrow || DownArrow || PageUp || PageDown))
                {
                    reduceOffset   = false;
                    offsetKeyHeld += Time.deltaTime / 3f;
                    if (offsetKeyHeld > 1f)
                    {
                        offsetKeyHeld = 1f;
                    }
                    float speed = Time.deltaTime * Mathf.Lerp(0.2f, 2f, offsetKeyHeld);

                    if (RightArrow)
                    {
                        targetOffsetSize += CameraRight * speed;
                    }
                    else if (LeftArrow)
                    {
                        targetOffsetSize += CameraRight * -speed;
                    }

                    if (UpArrow)
                    {
                        targetOffsetSize += CameraForward * speed;
                    }
                    else if (DownArrow)
                    {
                        targetOffsetSize += CameraForward * -speed;
                    }

                    if (PageUp)
                    {
                        targetOffsetSize += CameraUp * speed;
                    }
                    else if (PageDown)
                    {
                        targetOffsetSize += CameraUp * -speed;
                    }
                }
                else
                {
                    offsetKeyHeld -= Time.deltaTime * 2f;
                    if (offsetKeyHeld < 0f)
                    {
                        offsetKeyHeld = 0f;
                    }
                }

                if (reduceOffset)
                {
                    // add this as a setting
                    if (targetOffsetSize.magnitude > 0.00001f)
                    {
                        float trackingSpeed = lockOnTarget.name == CameraTargetManager.MOVEMENTPOINT_NAME ? trackingSpeedMax : trackingSpeedNormal;
                        targetOffsetSize = Vector3.MoveTowards(targetOffsetSize, new Vector3(), targetOffsetSize.magnitude / (1f / trackingSpeed));
                    }
                    else
                    {
                        targetOffsetSize = new Vector3();
                        reduceOffset     = false;
                    }
                }

                if (AllowTracking)
                {
                    float trackingSpeed;
                    float leash;
                    if (lockOnTarget.name == CameraTargetManager.MOVEMENTPOINT_NAME)
                    {
                        trackingSpeed = trackingSpeedMax;
                        leash         = 0f;
                    }
                    else
                    {
                        trackingSpeed = trackingSpeedNormal;
                        leash         = lockLeashLength;
                    }

                    float distance = Vector3.Distance(CameraTargetPos, lastTargetPos.Value);
                    if (distance > leash + 0.00001f)
                    {
                        CameraTargetPos = Vector3.MoveTowards(CameraTargetPos, LockOnTargetPos + targetOffsetSize, (distance - leash) * trackingSpeed * Time.deltaTime * 60f);
                    }
                    CameraTargetPos      += targetOffsetSize - targetOffsetSizeAdded;
                    targetOffsetSizeAdded = targetOffsetSize;
                    lastTargetPos         = LockOnTargetPos + targetOffsetSize;
                }
            }

            if (Input.GetKeyDown(KeyCode.Escape))
            {
                HideLockOnTargets();
            }

            if (manageCursorVisibility)
            {
                if (!cursorLocked)
                {
                    if (GUIUtility.hotControl == 0 && !EventSystem.current.IsPointerOverGameObject() && Hotkey.allowHotkeys)
                    {
                        bool mouseDown0 = Input.GetMouseButtonDown(0);
                        bool mouseDown1 = Input.GetMouseButtonDown(1);

                        if (mouseDown0 || mouseDown1)
                        {
                            if (mouseDown0)
                            {
                                mouseButtonDown0 = true;
                            }
                            if (mouseDown1)
                            {
                                mouseButtonDown1 = true;
                            }

                            Cursor.visible   = false;
                            Cursor.lockState = CursorLockMode.Confined;

                            cursorLocked = true;
                            WinCursor.GetCursorPos(out lockPos);
                        }
                    }
                }

                if (cursorLocked)
                {
                    bool mouseUp0 = Input.GetMouseButtonUp(0);
                    bool mouseUp1 = Input.GetMouseButtonUp(1);

                    if ((mouseButtonDown0 || mouseButtonDown1) && (mouseUp0 || mouseUp1))
                    {
                        if (mouseUp0)
                        {
                            mouseButtonDown0 = false;
                        }
                        if (mouseUp1)
                        {
                            mouseButtonDown1 = false;
                        }

                        if (!mouseButtonDown0 && !mouseButtonDown1)
                        {
                            Cursor.lockState = CursorLockMode.None;
                            Cursor.visible   = true;
                            cursorLocked     = false;
                        }
                    }

                    if (cursorLocked)
                    {
                        WinCursor.SetCursorPos(lockPos.x, lockPos.y);
                    }
                }
            }
        }