コード例 #1
0
        public static CameraDestoryer Create(CameraManager manager)
        {
            GameObject      gameObject = new GameObject("SanyoCamera-CameraDestoryer");
            CameraDestoryer destroyer  = gameObject.AddComponent <CameraDestoryer>();

            destroyer.manager = manager;
            return(destroyer);
        }
コード例 #2
0
ファイル: CameraManager.cs プロジェクト: eajtciv/SanyoCamera
        public void CreateCamera()
        {
            this.MainCamera    = UnityEngine.Camera.main;
            this.MainCameraFOV = this.MainCamera.fieldOfView;
            if (this.CameraFoV == 0)
            {
                this.CameraFoV = this.MainCameraFOV;
            }
            if (this.CameraNearClip == 0)
            {
                this.CameraNearClip = this.MainCamera.nearClipPlane;
            }
            if (this.CameraForClip == 0)
            {
                this.CameraForClip = this.MainCamera.farClipPlane;
            }
            this.MainCamera.enabled = false;
            // free camera on
            this.MainCamera.GetComponent <RideCameraController>().ONGNOMCJBGE = true;
            // copy camera object
            this.CameraObject      = UnityEngine.Object.Instantiate(this.MainCamera.gameObject);
            this.CameraObject.name = "Camera";
            this.Camera            = this.CameraObject.GetComponent <UnityEngine.Camera>();
            this.Camera.enabled    = true;
            this.CameraTransform   = this.CameraObject.transform;
            if (this.RootObject != null)
            {
                this.CameraTransform.SetParent(this.RootObject.transform);
            }
            this.CameraObject.transform.position = this.MainCamera.transform.position;
            // delete components
            UnityEngine.AudioListener audioLis = this.CameraObject.GetComponent <UnityEngine.AudioListener>();
            if (audioLis != null)
            {
                UnityEngine.Object.DestroyImmediate(audioLis);
            }
            audioLis = null;

            UnityEngine.GUILayer guilayer = this.CameraObject.GetComponent <UnityEngine.GUILayer>();
            if (guilayer != null)
            {
                UnityEngine.Object.DestroyImmediate(guilayer);
            }
            guilayer = null;

            RideCameraController rideCamCntrl = this.CameraObject.GetComponent <RideCameraController>();

            rideCamCntrl.ONGNOMCJBGE = true;
            if (rideCamCntrl != null)
            {
                UnityEngine.Object.DestroyImmediate(rideCamCntrl);
            }
            rideCamCntrl = null;

            Skybox skybox = this.CameraObject.GetComponent <Skybox>();

            if (skybox != null)
            {
                UnityEngine.Object.DestroyImmediate(skybox);
            }
            skybox = null;

            this.cameraDestoryer = CameraDestoryer.Create(this);
        }