Exemplo n.º 1
0
    // Token: 0x06000747 RID: 1863 RVA: 0x00032598 File Offset: 0x00030798
    private void SetCameraMode(LevelCamera.CameraMode mode, Transform target)
    {
        this.Feedback.timeToEnd = 0f;
        LevelCamera.CurrentMode = mode;
        this._currentState.Finish();
        if (LevelCamera.IsZoomedIn)
        {
            LevelCamera.DoZoomOut(75f, 10f);
        }
        if (this.MainCamera != null)
        {
            this.MainCamera.transform.localRotation = Quaternion.identity;
            this.MainCamera.transform.localPosition = Vector3.zero;
            switch (mode)
            {
            case LevelCamera.CameraMode.Disabled:
                this.TargetTransform = null;
                this._currentState   = new LevelCamera.DisabledState(this, Vector3.zero);
                if (GameState.Current.Avatar.Decorator != null)
                {
                    GameState.Current.Avatar.Decorator.gameObject.SetActive(true);
                }
                if (GameState.Current.Player.WeaponCamera != null)
                {
                    GameState.Current.Player.WeaponCamera.IsEnabled = false;
                }
                break;

            case LevelCamera.CameraMode.FirstPerson:
                this.MainCamera.cullingMask = LayerUtil.RemoveFromLayerMask(this.MainCamera.cullingMask, new UberstrikeLayer[]
                {
                    UberstrikeLayer.LocalPlayer,
                    UberstrikeLayer.Weapons
                });
                this.MainCamera.cullingMask = LayerUtil.AddToLayerMask(this.MainCamera.cullingMask, new UberstrikeLayer[]
                {
                    UberstrikeLayer.RemoteProjectile
                });
                this.TargetTransform = GameState.Current.Player.CameraTarget;
                this._currentState   = new LevelCamera.FirstPersonState(this, GameState.Current.Player.EyePosition);
                if (GameState.Current.Avatar.Decorator != null)
                {
                    GameState.Current.Avatar.Decorator.gameObject.SetActive(false);
                }
                if (GameState.Current.Player.WeaponCamera)
                {
                    GameState.Current.Player.WeaponCamera.IsEnabled = true;
                }
                break;

            case LevelCamera.CameraMode.OrbitAround:
                this.MainCamera.cullingMask = LayerUtil.AddToLayerMask(this.MainCamera.cullingMask, new UberstrikeLayer[]
                {
                    UberstrikeLayer.LocalPlayer
                });
                this.TargetTransform = GameState.Current.Player.CameraTarget;
                this.RotationOffset  = 180f;
                this._currentState   = new LevelCamera.OrbitAroundState(this, new Vector3(0f, -0.5f, 0f));
                if (GameState.Current.Avatar.Decorator != null && GameState.Current.Avatar.Ragdoll == null)
                {
                    GameState.Current.Avatar.Decorator.gameObject.SetActive(true);
                }
                if (GameState.Current.Player.WeaponCamera)
                {
                    GameState.Current.Player.WeaponCamera.IsEnabled = false;
                }
                break;

            case LevelCamera.CameraMode.Paused:
                this.MainCamera.cullingMask = LayerUtil.AddToLayerMask(this.MainCamera.cullingMask, new UberstrikeLayer[]
                {
                    UberstrikeLayer.LocalPlayer
                });
                this.TargetTransform = GameState.Current.Player.CameraTarget;
                this.RotationOffset  = 0f;
                this._currentState   = new LevelCamera.OrbitAroundState(this, new Vector3(0f, -0.5f, 0f));
                if (GameState.Current.Avatar.Decorator != null && GameState.Current.Avatar.Ragdoll == null)
                {
                    GameState.Current.Avatar.Decorator.gameObject.SetActive(true);
                }
                if (GameState.Current.Player.WeaponCamera)
                {
                    GameState.Current.Player.WeaponCamera.IsEnabled = false;
                }
                break;

            case LevelCamera.CameraMode.FreeSpectator:
                this.MainCamera.cullingMask = LayerUtil.AddToLayerMask(this.MainCamera.cullingMask, new UberstrikeLayer[]
                {
                    UberstrikeLayer.LocalPlayer
                });
                this.TargetTransform = null;
                this._currentState   = new LevelCamera.SpectatorState(this, Vector3.zero);
                if (GameState.Current.Avatar.Decorator != null)
                {
                    GameState.Current.Avatar.Decorator.gameObject.SetActive(false);
                }
                if (GameState.Current.Player.WeaponCamera)
                {
                    GameState.Current.Player.WeaponCamera.IsEnabled = false;
                }
                break;

            case LevelCamera.CameraMode.SmoothFollow:
                this.MainCamera.cullingMask = LayerUtil.AddToLayerMask(this.MainCamera.cullingMask, new UberstrikeLayer[]
                {
                    UberstrikeLayer.LocalPlayer
                });
                this.TargetTransform = target;
                this._currentState   = new LevelCamera.SmoothFollowState(this, new Vector3(0f, 1.3f, 0f));
                break;

            case LevelCamera.CameraMode.Ragdoll:
                this.MainCamera.cullingMask = LayerUtil.AddToLayerMask(this.MainCamera.cullingMask, new UberstrikeLayer[]
                {
                    UberstrikeLayer.LocalPlayer
                });
                this.TargetTransform = GameState.Current.Avatar.Ragdoll.GetBone(BoneIndex.Hips);
                this._currentState   = new LevelCamera.RagdollState(this, new Vector3(0f, 1f, 0f));
                if (GameState.Current.Player.WeaponCamera)
                {
                    GameState.Current.Player.WeaponCamera.IsEnabled = false;
                }
                break;

            default:
                Debug.LogError("Camera does not support " + mode.ToString());
                break;
            }
        }
    }