示例#1
0
    public void ActivateCamera(CAMERA_TYPE camType, bool force)
    {
        if (!force && selectedCamera == camType)
        {
            return;                                              // Already active
        }
        DisableCamera(selectedCamera);
        switch (camType)
        {
        case CAMERA_TYPE.CAMERA_ORBIT:
            selectedCamera   = CAMERA_TYPE.CAMERA_ORBIT;
            camOrbit.enabled = true;
            camOrbit.Activate();
            currentCamera = camOrbit;
            break;

        case CAMERA_TYPE.CAMERA_FPS:
            selectedCamera = CAMERA_TYPE.CAMERA_FPS;
            camFPS.enabled = true;
            camFPS.Activate();
            currentCamera = camFPS;
            break;

        case CAMERA_TYPE.CAMERA_OVR:
            DefaultCamera.SetActive(false);
            //camFPS.enabled = true;
            //camFPS.Activate();
            selectedCamera = CAMERA_TYPE.CAMERA_OVR;
            OVR_Controller.SetActive(true);
            //currentCamera = camFPS;
            break;
        }
    }
示例#2
0
    public CAMERA_TYPE chageCamera()
    {
        bool        flag       = false;
        CAMERA_TYPE cameraMode = IN_GAME_MAIN_CAMERA.cameraMode;
        int         num        = 0;

        while (!flag)
        {
            num++;
            switch (cameraMode)
            {
            case CAMERA_TYPE.ORIGINAL:
                cameraMode        = CAMERA_TYPE.WOW;
                Screen.lockCursor = false;
                if (((int)FengGameManagerMKII.settings[0x146]) == 0)
                {
                    flag = true;
                }
                break;

            case CAMERA_TYPE.WOW:
                cameraMode        = CAMERA_TYPE.TPS;
                Screen.lockCursor = true;
                if (((int)FengGameManagerMKII.settings[0x145]) == 0)
                {
                    flag = true;
                }
                break;

            case CAMERA_TYPE.TPS:
                cameraMode        = CAMERA_TYPE.oldTPS;
                Screen.lockCursor = true;
                if (((int)FengGameManagerMKII.settings[0x147]) == 0)
                {
                    flag = true;
                }
                break;

            case CAMERA_TYPE.oldTPS:
                cameraMode        = CAMERA_TYPE.ORIGINAL;
                Screen.lockCursor = false;
                if (((int)FengGameManagerMKII.settings[0x144]) == 0)
                {
                    flag = true;
                }
                break;
            }
            if (num > 10)
            {
                cameraMode        = CAMERA_TYPE.ORIGINAL;
                Screen.lockCursor = false;
                flag = true;
            }
        }
        PrefersCyan.SetString("string_cameraType", cameraMode.ToString());
        return(cameraMode);
    }
 public static void LockCamera(bool needLock)
 {
     if (needLock)
     {
         if (cameraMode != CAMERA_TYPE.TPS)
         {
             Old = cameraMode;
         }
         cameraMode        = CAMERA_TYPE.TPS;
         Screen.showCursor = true;
         Screen.lockCursor = true;
     }
     else
     {
         cameraMode        = Old;
         Screen.lockCursor = cameraMode == CAMERA_TYPE.TPS || cameraMode == CAMERA_TYPE.OLDTPS;
         Screen.showCursor = false;
     }
 }
示例#4
0
    public void DisableCamera(CAMERA_TYPE camType)
    {
        switch (camType)
        {
        case CAMERA_TYPE.CAMERA_ORBIT:
            camOrbit.Disactivate();
            camOrbit.enabled = false;
            break;

        case CAMERA_TYPE.CAMERA_FPS:
            camFPS.Disactivate();
            camFPS.enabled = false;
            break;

        case CAMERA_TYPE.CAMERA_OVR:
            OVR_Controller.SetActive(false);
            DefaultCamera.SetActive(true);
            //camFPS.Disactivate();
            break;
        }
    }
    public void update2()
    {
        if (flashDuration > 0f)
        {
            flashDuration -= UnityEngine.Time.deltaTime;
            if (flashDuration <= 0f)
            {
                flashDuration = 0f;
            }
            GameObject.Find("flash").GetComponent <UISprite>().alpha = flashDuration * 0.5f;
        }
        if (Gametype == GameType.Stop)
        {
            Screen.showCursor = true;
            Screen.lockCursor = false;
            return;
        }
        if (Gametype != GameType.Singleplayer && gameOver)
        {
            if (inputManager.isInputDown[InputCode.Attack1])
            {
                if (spectatorMode)
                {
                    SetSpectorMode(val: false);
                }
                else
                {
                    SetSpectorMode(val: true);
                }
            }
            if (inputManager.isInputDown[InputCode.Flare1])
            {
                GameObject[] players = GameObject.FindGameObjectsWithTag("Player");
                currentPeekPlayerIndex = (currentPeekPlayerIndex + 1) % players.Length;
                if (players.Length > 0)
                {
                    SetMainObject(players[currentPeekPlayerIndex]);
                    SetSpectorMode(val: false);
                    lockAngle = false;
                }
            }
            if (inputManager.isInputDown[InputCode.Flare2])
            {
                currentPeekPlayerIndex--;
                GameObject[] players = GameObject.FindGameObjectsWithTag("Player");
                int          num2    = players.Length;
                if (currentPeekPlayerIndex >= num2)
                {
                    currentPeekPlayerIndex = 0;
                }
                if (currentPeekPlayerIndex < 0)
                {
                    currentPeekPlayerIndex = num2 - 1;
                }
                if (num2 > 0)
                {
                    SetMainObject(players[currentPeekPlayerIndex]);
                    SetSpectorMode(val: false);
                    lockAngle = false;
                }
            }
            if (spectatorMode)
            {
                return;
            }
        }
        if (inputManager.isInputDown[InputCode.Pause])
        {
            if (IsPausing)
            {
                if (main_object != null)
                {
                    Vector3 position = base.transform.position;
                    position  = ((head == null) ? main_object.transform.position : head.transform.position);
                    position += Vector3.up * heightMulti;
                    base.transform.position = Vector3.Lerp(base.transform.position, position - base.transform.forward * 5f, 0.2f);
                }
                return;
            }
            IsPausing = !IsPausing;
            if (IsPausing)
            {
                if (Gametype == GameType.Singleplayer)
                {
                    UnityEngine.Time.timeScale = 0f;
                }
                GameObject.Find("InputManagerController").GetComponent <FengCustomInputs>().menuOn = true;
                Screen.showCursor = true;
                Screen.lockCursor = false;
            }
        }
        if (needSetHUD)
        {
            needSetHUD = false;
            SetHUDPosition();
            Screen.lockCursor = !Screen.lockCursor;
            Screen.lockCursor = !Screen.lockCursor;
        }
        if (inputManager.isInputDown[InputCode.Fullscreen])
        {
            Screen.fullScreen = !Screen.fullScreen;
            if (Screen.fullScreen)
            {
                Screen.SetResolution(960, 600, fullscreen: false);
            }
            else
            {
                Screen.SetResolution(Screen.currentResolution.width, Screen.currentResolution.height, fullscreen: true);
            }
            needSetHUD = true;
            Minimap.OnScreenResolutionChanged();
        }
        if (inputManager.isInputDown[InputCode.Restart])
        {
            Reset();
        }
        if (main_object == null)
        {
            return;
        }
        if (inputManager.isInputDown[InputCode.ChangeCamera])
        {
            switch (CameraMode)
            {
            case CAMERA_TYPE.TPS:
                CameraMode        = CAMERA_TYPE.ORIGINAL;
                Screen.lockCursor = false;
                break;

            case CAMERA_TYPE.ORIGINAL:
                CameraMode        = CAMERA_TYPE.WOW;
                Screen.lockCursor = false;
                break;

            case CAMERA_TYPE.WOW:
                CameraMode        = CAMERA_TYPE.TPS;
                Screen.lockCursor = true;
                break;
            }
            if ((int)FengGameManagerMKII.Settings[245] == 1 || main_object.GetComponent <HERO>() == null)
            {
                Screen.showCursor = false;
            }
        }
        if (inputManager.isInputDown[InputCode.ToggleCursor])
        {
            Screen.showCursor = !Screen.showCursor;
        }
        if (inputManager.isInputDown[InputCode.Focus])
        {
            TriggerAutoLock = !TriggerAutoLock;
            if (TriggerAutoLock)
            {
                lockTarget = FindNearestTitan();
                if (closestDistance >= 150f)
                {
                    lockTarget      = null;
                    TriggerAutoLock = false;
                }
            }
        }
        if (gameOver)
        {
            if (FengGameManagerMKII.InputRC.isInputHumanDown(InputCodeRC.LiveCamera))
            {
                if ((int)FengGameManagerMKII.Settings[263] == 0)
                {
                    FengGameManagerMKII.Settings[263] = 1;
                }
                else
                {
                    FengGameManagerMKII.Settings[263] = 0;
                }
            }
            HERO component = main_object.GetComponent <HERO>();
            if (component != null && (int)FengGameManagerMKII.Settings[263] == 1 && component.GetComponent <SmoothSyncMovement>().enabled&& component.isPhotonCamera)
            {
                CameraMovementLive(component);
            }
            else if (lockAngle)
            {
                base.transform.rotation = Quaternion.Lerp(base.transform.rotation, main_object.transform.rotation, 0.2f);
                base.transform.position = Vector3.Lerp(base.transform.position, main_object.transform.position - main_object.transform.forward * 5f, 0.2f);
            }
            else
            {
                MoveCamera();
            }
        }
        else
        {
            MoveCamera();
        }
        if (TriggerAutoLock && lockTarget != null)
        {
            float     z         = base.transform.eulerAngles.z;
            Transform transform = lockTarget.transform.Find("Amarture/Core/Controller_Body/hip/spine/chest/neck");
            Vector3   a         = transform.position - ((head == null) ? main_object.transform.position : head.transform.position);
            a.Normalize();
            lockCameraPosition      = ((head == null) ? main_object.transform.position : head.transform.position);
            lockCameraPosition     -= a * distance * distanceMulti * distanceOffsetMulti;
            lockCameraPosition     += Vector3.up * 3f * heightMulti * distanceOffsetMulti;
            base.transform.position = Vector3.Lerp(base.transform.position, lockCameraPosition, UnityEngine.Time.deltaTime * 4f);
            if (head != null)
            {
                base.transform.LookAt(head.transform.position * 0.8f + transform.position * 0.2f);
            }
            else
            {
                base.transform.LookAt(main_object.transform.position * 0.8f + transform.position * 0.2f);
            }
            base.transform.localEulerAngles = new Vector3(base.transform.eulerAngles.x, base.transform.eulerAngles.y, z);
            Vector2 vector = base.camera.WorldToScreenPoint(transform.position - transform.forward * lockTarget.transform.localScale.x);
            locker.transform.localPosition = new Vector3(vector.x - (float)Screen.width * 0.5f, vector.y - (float)Screen.height * 0.5f, 0f);
            if (lockTarget.GetComponent <TITAN>() != null && lockTarget.GetComponent <TITAN>().hasDie)
            {
                lockTarget = null;
            }
        }
        else
        {
            locker.transform.localPosition = new Vector3(0f, (float)(-Screen.height) * 0.5f - 50f, 0f);
        }
        Vector3 end        = (head == null) ? main_object.transform.position : head.transform.position;
        Vector3 normalized = (((head == null) ? main_object.transform.position : head.transform.position) - base.transform.position).normalized;

        end -= distance * normalized * distanceMulti;
        LayerMask  mask  = 1 << LayerMask.NameToLayer("Ground");
        LayerMask  mask2 = 1 << LayerMask.NameToLayer("EnemyBox");
        LayerMask  mask3 = (int)mask | (int)mask2;
        RaycastHit hitInfo;

        if (head != null)
        {
            if (Physics.Linecast(head.transform.position, end, out hitInfo, mask))
            {
                base.transform.position = hitInfo.point;
            }
            else if (Physics.Linecast(head.transform.position - normalized * distanceMulti * 3f, end, out hitInfo, mask2))
            {
                base.transform.position = hitInfo.point;
            }
            Debug.DrawLine(head.transform.position - normalized * distanceMulti * 3f, end, Color.red);
        }
        else if (Physics.Linecast(main_object.transform.position + Vector3.up, end, out hitInfo, mask3))
        {
            base.transform.position = hitInfo.point;
        }
        UpdateShake();
    }
示例#6
0
 public void update()
 {
     if (this.flashDuration > 0f)
     {
         this.flashDuration -= Time.deltaTime;
         if (this.flashDuration <= 0f)
         {
             this.flashDuration = 0f;
         }
         GameObject.Find("flash").GetComponent <UISprite>().alpha = this.flashDuration * 0.5f;
     }
     if (gametype == GAMETYPE.STOP)
     {
         Screen.showCursor = true;
         Screen.lockCursor = false;
     }
     else
     {
         if ((gametype != GAMETYPE.SINGLE) && this.gameOver)
         {
             if (this.inputManager.isInputDown[InputCode.attack1])
             {
                 if (this.spectatorMode)
                 {
                     this.setSpectorMode(false);
                 }
                 else
                 {
                     this.setSpectorMode(true);
                 }
             }
             if (this.inputManager.isInputDown[InputCode.flare1])
             {
                 this.currentPeekPlayerIndex++;
                 int length = GameObject.FindGameObjectsWithTag("Player").Length;
                 if (this.currentPeekPlayerIndex >= length)
                 {
                     this.currentPeekPlayerIndex = 0;
                 }
                 if (length > 0)
                 {
                     this.setMainObject(GameObject.FindGameObjectsWithTag("Player")[this.currentPeekPlayerIndex], true, false);
                     this.setSpectorMode(false);
                     this.lockAngle = false;
                 }
             }
             if (this.inputManager.isInputDown[InputCode.flare2])
             {
                 this.currentPeekPlayerIndex--;
                 int num2 = GameObject.FindGameObjectsWithTag("Player").Length;
                 if (this.currentPeekPlayerIndex >= num2)
                 {
                     this.currentPeekPlayerIndex = 0;
                 }
                 if (this.currentPeekPlayerIndex < 0)
                 {
                     this.currentPeekPlayerIndex = num2;
                 }
                 if (num2 > 0)
                 {
                     this.setMainObject(GameObject.FindGameObjectsWithTag("Player")[this.currentPeekPlayerIndex], true, false);
                     this.setSpectorMode(false);
                     this.lockAngle = false;
                 }
             }
             if (this.spectatorMode)
             {
                 return;
             }
         }
         if (this.inputManager.isInputDown[InputCode.pause])
         {
             if (isPausing)
             {
                 if (this.main_object != null)
                 {
                     Vector3 position = base.transform.position;
                     position  = (this.head == null) ? this.main_object.transform.position : this.head.transform.position;
                     position += (Vector3)(Vector3.up * this.heightMulti);
                     base.transform.position = Vector3.Lerp(base.transform.position, position - ((Vector3)(base.transform.forward * 5f)), 0.2f);
                 }
                 return;
             }
             isPausing = !isPausing;
             if (isPausing)
             {
                 if (gametype == GAMETYPE.SINGLE)
                 {
                     Time.timeScale = 0f;
                 }
                 GameObject obj3 = GameObject.Find("UI_IN_GAME");
                 NGUITools.SetActive(obj3.GetComponent <UIReferArray>().panels[0], false);
                 NGUITools.SetActive(obj3.GetComponent <UIReferArray>().panels[1], true);
                 NGUITools.SetActive(obj3.GetComponent <UIReferArray>().panels[2], false);
                 NGUITools.SetActive(obj3.GetComponent <UIReferArray>().panels[3], false);
                 GameObject.Find("InputManagerController").GetComponent <FengCustomInputs>().showKeyMap();
                 GameObject.Find("InputManagerController").GetComponent <FengCustomInputs>().justUPDATEME();
                 GameObject.Find("InputManagerController").GetComponent <FengCustomInputs>().menuOn = true;
                 Screen.showCursor = true;
                 Screen.lockCursor = false;
             }
         }
         if (this.needSetHUD)
         {
             this.needSetHUD = false;
             this.setHUDposition();
         }
         if (this.inputManager.isInputDown[InputCode.fullscreen])
         {
             Screen.fullScreen = !Screen.fullScreen;
             if (Screen.fullScreen)
             {
                 Screen.SetResolution(960, 600, false);
             }
             else
             {
                 Screen.SetResolution(Screen.currentResolution.width, Screen.currentResolution.height, true);
             }
             this.needSetHUD = true;
         }
         if (this.inputManager.isInputDown[InputCode.restart])
         {
             this.reset();
         }
         if (this.main_object != null)
         {
             RaycastHit hit;
             if (this.inputManager.isInputDown[InputCode.camera])
             {
                 if (cameraMode == CAMERA_TYPE.ORIGINAL)
                 {
                     cameraMode        = CAMERA_TYPE.WOW;
                     Screen.lockCursor = false;
                 }
                 else if (cameraMode == CAMERA_TYPE.WOW)
                 {
                     cameraMode        = CAMERA_TYPE.TPS;
                     Screen.lockCursor = true;
                 }
                 else if (cameraMode == CAMERA_TYPE.TPS)
                 {
                     cameraMode        = CAMERA_TYPE.ORIGINAL;
                     Screen.lockCursor = false;
                 }
                 this.verticalRotationOffset = 0f;
             }
             if (this.inputManager.isInputDown[InputCode.hideCursor])
             {
                 Screen.showCursor = !Screen.showCursor;
             }
             if (this.inputManager.isInputDown[InputCode.focus])
             {
                 triggerAutoLock = !triggerAutoLock;
                 if (triggerAutoLock)
                 {
                     this.lockTarget = this.findNearestTitan();
                     if (this.closestDistance >= 150f)
                     {
                         this.lockTarget = null;
                         triggerAutoLock = false;
                     }
                 }
             }
             if ((this.gameOver && this.lockAngle) && (this.main_object != null))
             {
                 base.transform.rotation = Quaternion.Lerp(base.transform.rotation, this.main_object.transform.rotation, 0.2f);
                 base.transform.position = Vector3.Lerp(base.transform.position, this.main_object.transform.position - ((Vector3)(this.main_object.transform.forward * 5f)), 0.2f);
             }
             else
             {
                 this.camareMovement();
             }
             if (triggerAutoLock && (this.lockTarget != null))
             {
                 float     z         = base.transform.eulerAngles.z;
                 Transform transform = this.lockTarget.transform.Find("Amarture/Core/Controller_Body/hip/spine/chest/neck");
                 Vector3   vector2   = transform.position - ((this.head == null) ? this.main_object.transform.position : this.head.transform.position);
                 vector2.Normalize();
                 this.lockCameraPosition  = (this.head == null) ? this.main_object.transform.position : this.head.transform.position;
                 this.lockCameraPosition -= (Vector3)(((vector2 * this.distance) * this.distanceMulti) * this.distanceOffsetMulti);
                 this.lockCameraPosition += (Vector3)(((Vector3.up * 3f) * this.heightMulti) * this.distanceOffsetMulti);
                 base.transform.position  = Vector3.Lerp(base.transform.position, this.lockCameraPosition, Time.deltaTime * 4f);
                 if (this.head != null)
                 {
                     base.transform.LookAt((Vector3)((this.head.transform.position * 0.8f) + (transform.position * 0.2f)));
                 }
                 else
                 {
                     base.transform.LookAt((Vector3)((this.main_object.transform.position * 0.8f) + (transform.position * 0.2f)));
                 }
                 base.transform.localEulerAngles = new Vector3(base.transform.eulerAngles.x, base.transform.eulerAngles.y, z);
                 Vector2 vector3 = base.camera.WorldToScreenPoint(transform.position - ((Vector3)(transform.forward * this.lockTarget.transform.localScale.x)));
                 this.locker.transform.localPosition = new Vector3(vector3.x - (Screen.width * 0.5f), vector3.y - (Screen.height * 0.5f), 0f);
                 if ((this.lockTarget.GetComponent <TITAN>() != null) && this.lockTarget.GetComponent <TITAN>().hasDie)
                 {
                     this.lockTarget = null;
                 }
             }
             else
             {
                 this.locker.transform.localPosition = new Vector3(0f, (-Screen.height * 0.5f) - 50f, 0f);
             }
             Vector3 end        = (this.head == null) ? this.main_object.transform.position : this.head.transform.position;
             Vector3 vector10   = ((this.head == null) ? this.main_object.transform.position : this.head.transform.position) - base.transform.position;
             Vector3 normalized = vector10.normalized;
             end -= (Vector3)((this.distance * normalized) * this.distanceMulti);
             LayerMask mask  = ((int)1) << LayerMask.NameToLayer("Ground");
             LayerMask mask2 = ((int)1) << LayerMask.NameToLayer("EnemyBox");
             LayerMask mask3 = mask | mask2;
             if (this.head != null)
             {
                 if (Physics.Linecast(this.head.transform.position, end, out hit, (int)mask))
                 {
                     base.transform.position = hit.point;
                 }
                 else if (Physics.Linecast(this.head.transform.position - ((Vector3)((normalized * this.distanceMulti) * 3f)), end, out hit, (int)mask2))
                 {
                     base.transform.position = hit.point;
                 }
                 Debug.DrawLine(this.head.transform.position - ((Vector3)((normalized * this.distanceMulti) * 3f)), end, Color.red);
             }
             else if (Physics.Linecast(this.main_object.transform.position + Vector3.up, end, out hit, (int)mask3))
             {
                 base.transform.position = hit.point;
             }
             this.shakeUpdate();
         }
     }
 }
    public void update()
    {
        if (Settings.MinimapSetting && RCSettings.globalDisableMinimap != 1 && !Minimap.instance.isEnabled)
        {
            gameObject.GetComponent <Minimap>().SetEnabled(true);
            Minimap.TryRecaptureInstance();
        }

        if (flashDuration > 0f)
        {
            flashDuration -= Time.deltaTime;
            if (flashDuration <= 0f)
            {
                flashDuration = 0f;
            }

            GameObjectCache.Find("flash").GetComponent <UISprite>().alpha = flashDuration * 0.5f;
        }

        if (gametype == GAMETYPE.STOP)
        {
            Screen.showCursor = true;
            Screen.lockCursor = false;
        }
        else
        {
            if (gametype != GAMETYPE.SINGLE && gameOver)
            {
                if (inputManager.isInputDown[InputCode.attack1])
                {
                    if (spectatorMode)
                    {
                        setSpectorMode(false);
                    }
                    else
                    {
                        setSpectorMode(true);
                    }
                }

                if (Input.GetKeyDown(KeyCode.Alpha2))
                {
                    currentPeekPlayerIndex++;
                    var length = GameObject.FindGameObjectsWithTag("Player").Length;
                    if (currentPeekPlayerIndex >= length)
                    {
                        currentPeekPlayerIndex = 0;
                    }

                    if (length > 0)
                    {
                        setMainObject(GameObject.FindGameObjectsWithTag("Player")[currentPeekPlayerIndex]);
                        setSpectorMode(false);
                        lockAngle = false;
                    }
                }

                if (Input.GetKeyDown(KeyCode.Alpha1))
                {
                    currentPeekPlayerIndex--;
                    var num2 = GameObject.FindGameObjectsWithTag("Player").Length;
                    if (currentPeekPlayerIndex >= num2)
                    {
                        currentPeekPlayerIndex = 0;
                    }

                    if (currentPeekPlayerIndex < 0)
                    {
                        currentPeekPlayerIndex = num2;
                    }

                    if (num2 > 0)
                    {
                        setMainObject(GameObject.FindGameObjectsWithTag("Player")[currentPeekPlayerIndex]);
                        setSpectorMode(false);
                        lockAngle = false;
                    }
                }

                if (spectatorMode)
                {
                    return;
                }
            }

            if (inputManager.isInputDown[InputCode.pause])
            {
                if (isPausing)
                {
                    if (main_object != null)
                    {
                        var position = transform.position;
                        position           = head == null ? main_object.transform.position : head.transform.position;
                        position          += Vector3.up * heightMulti;
                        transform.position = Vector3.Lerp(transform.position, position - transform.forward * 5f, 0.2f);
                    }

                    return;
                }

                isPausing = !isPausing;
                if (isPausing)
                {
                    if (gametype == GAMETYPE.SINGLE)
                    {
                        Time.timeScale = 0f;
                    }

                    GameObjectCache.Find("InputManagerController").GetComponent <FengCustomInputs>().menuOn = true;
                    Page.GetInstance <PauseMenu>().Enable();
                    Screen.showCursor = true;
                    Screen.lockCursor = false;
                }
            }

            if (needSetHUD)
            {
                needSetHUD = false;
                setHUDposition();
                Screen.lockCursor = !Screen.lockCursor;
                Screen.lockCursor = !Screen.lockCursor;
            }

            if (inputManager.isInputDown[InputCode.fullscreen])
            {
                Screen.fullScreen = !Screen.fullScreen;
                if (Screen.fullScreen)
                {
                    Screen.SetResolution(960, 600, false);
                }
                else
                {
                    Screen.SetResolution(Screen.currentResolution.width, Screen.currentResolution.height, true);
                }

                needSetHUD = true;
                Minimap.OnScreenResolutionChanged();
            }

            if (inputManager.isInputDown[InputCode.restart])
            {
                reset();
            }

            if (main_object != null)
            {
                RaycastHit hit;
                if (inputManager.isInputDown[InputCode.camera])
                {
                    switch (cameraMode)
                    {
                    case CAMERA_TYPE.ORIGINAL:
                        if (Settings.CameraTypeSettings[2])
                        {
                            cameraMode        = CAMERA_TYPE.WOW;
                            Screen.lockCursor = false;
                        }
                        else if (Settings.CameraTypeSettings[1])
                        {
                            cameraMode        = CAMERA_TYPE.TPS;
                            Screen.lockCursor = true;
                        }
                        else if (Settings.CameraTypeSettings[3])
                        {
                            cameraMode        = CAMERA_TYPE.OLDTPS;
                            Screen.lockCursor = true;
                        }

                        break;

                    case CAMERA_TYPE.WOW:
                        if (Settings.CameraTypeSettings[1])
                        {
                            cameraMode        = CAMERA_TYPE.TPS;
                            Screen.lockCursor = true;
                        }
                        else if (Settings.CameraTypeSettings[3])
                        {
                            cameraMode        = CAMERA_TYPE.OLDTPS;
                            Screen.lockCursor = true;
                        }
                        else if (Settings.CameraTypeSettings[0])
                        {
                            cameraMode        = CAMERA_TYPE.ORIGINAL;
                            Screen.lockCursor = false;
                        }

                        break;

                    case CAMERA_TYPE.TPS:
                        if (Settings.CameraTypeSettings[3])
                        {
                            cameraMode        = CAMERA_TYPE.OLDTPS;
                            Screen.lockCursor = true;
                        }
                        else if (Settings.CameraTypeSettings[0])
                        {
                            cameraMode        = CAMERA_TYPE.ORIGINAL;
                            Screen.lockCursor = false;
                        }
                        else if (Settings.CameraTypeSettings[2])
                        {
                            cameraMode        = CAMERA_TYPE.WOW;
                            Screen.lockCursor = false;
                        }

                        break;

                    case CAMERA_TYPE.OLDTPS:
                        if (Settings.CameraTypeSettings[0])
                        {
                            cameraMode        = CAMERA_TYPE.ORIGINAL;
                            Screen.lockCursor = false;
                        }
                        else if (Settings.CameraTypeSettings[2])
                        {
                            cameraMode        = CAMERA_TYPE.WOW;
                            Screen.lockCursor = false;
                        }
                        else if (Settings.CameraTypeSettings[1])
                        {
                            cameraMode        = CAMERA_TYPE.TPS;
                            Screen.lockCursor = true;
                        }

                        break;
                    }

                    if ((int)FengGameManagerMKII.settings[245] == 1 || main_object.GetComponent <HERO>() == null)
                    {
                        Screen.showCursor = false;
                    }
                }

                if (inputManager.isInputDown[InputCode.hideCursor])
                {
                    Screen.showCursor = !Screen.showCursor;
                }

                if (inputManager.isInputDown[InputCode.focus])
                {
                    triggerAutoLock = !triggerAutoLock;
                    if (triggerAutoLock)
                    {
                        lockTarget = findNearestTitan();
                        if (closestDistance >= 150f)
                        {
                            lockTarget      = null;
                            triggerAutoLock = false;
                        }
                    }
                }

                if (gameOver && main_object != null)
                {
                    if (FengGameManagerMKII.inputRC.isInputHumanDown(InputCodeRC.liveCam))
                    {
                        if ((int)FengGameManagerMKII.settings[263] == 0)
                        {
                            FengGameManagerMKII.settings[263] = 1;
                        }
                        else
                        {
                            FengGameManagerMKII.settings[263] = 0;
                        }
                    }

                    var component = main_object.GetComponent <HERO>();
                    if (component != null && (int)FengGameManagerMKII.settings[263] == 1 && component.GetComponent <SmoothSyncMovement>().enabled&& component.isPhotonCamera)
                    {
                        CameraMovementLive(component);
                    }
                    else if (lockAngle)
                    {
                        transform.rotation = Quaternion.Lerp(transform.rotation, main_object.transform.rotation, 0.2f);
                        transform.position = Vector3.Lerp(transform.position, main_object.transform.position - main_object.transform.forward * 5f, 0.2f);
                    }
                    else
                    {
                        camareMovement();
                    }
                }
                else
                {
                    camareMovement();
                }

                if (triggerAutoLock && lockTarget != null)
                {
                    var z         = this.transform.eulerAngles.z;
                    var transform = lockTarget.transform.Find("Amarture/Core/Controller_Body/hip/spine/chest/neck");
                    var vector2   = transform.position - (head == null ? main_object.transform.position : head.transform.position);
                    vector2.Normalize();
                    lockCameraPosition      = head == null ? main_object.transform.position : head.transform.position;
                    lockCameraPosition     -= vector2 * distance * distanceMulti * distanceOffsetMulti;
                    lockCameraPosition     += Vector3.up * 3f * heightMulti * distanceOffsetMulti;
                    this.transform.position = Vector3.Lerp(this.transform.position, lockCameraPosition, Time.deltaTime * 4f);
                    if (head != null)
                    {
                        this.transform.LookAt(head.transform.position * 0.8f + transform.position * 0.2f);
                    }
                    else
                    {
                        this.transform.LookAt(main_object.transform.position * 0.8f + transform.position * 0.2f);
                    }

                    this.transform.localEulerAngles = new Vector3(this.transform.eulerAngles.x, this.transform.eulerAngles.y, z);
                    Vector2 vector3 = camera.WorldToScreenPoint(transform.position - transform.forward * lockTarget.transform.localScale.x);
                    locker.transform.localPosition = new Vector3(vector3.x - Screen.width * 0.5f, vector3.y - Screen.height * 0.5f, 0f);
                    if (lockTarget.GetComponent <TITAN>() != null && lockTarget.GetComponent <TITAN>().hasDie)
                    {
                        lockTarget = null;
                    }
                }
                else
                {
                    locker.transform.localPosition = new Vector3(0f, -Screen.height * 0.5f - 50f, 0f);
                }

                var end        = head == null ? main_object.transform.position : head.transform.position;
                var vector5    = (head == null ? main_object.transform.position : head.transform.position) - this.transform.position;
                var normalized = vector5.normalized;
                end -= distance * normalized * distanceMulti;
                LayerMask mask  = 1 << LayerMask.NameToLayer("Ground");
                LayerMask mask2 = 1 << LayerMask.NameToLayer("EnemyBox");
                LayerMask mask3 = mask | mask2;
                if (head != null)
                {
                    if (Physics.Linecast(head.transform.position, end, out hit, mask))
                    {
                        transform.position = hit.point;
                    }
                    else if (Physics.Linecast(head.transform.position - normalized * distanceMulti * 3f, end, out hit, mask2))
                    {
                        transform.position = hit.point;
                    }

                    Debug.DrawLine(head.transform.position - normalized * distanceMulti * 3f, end, Color.red);
                }
                else if (Physics.Linecast(main_object.transform.position + Vector3.up, end, out hit, mask3))
                {
                    transform.position = hit.point;
                }

                shakeUpdate();
            }
        }
    }