Example #1
0
    // Update is called once per frame
    void Update()
    {
        //カメラ切替
        _camera_slider.SetActive(false);
        switch (_camera_mode)
        {
        case CAMERA_MODE.PLAY:
            _camera_slider.SetActive(true);
            _play_camera.update( );
            break;

        case CAMERA_MODE.EVENT:
            _event_camera.update( );
            if (_event_camera.isfinish( ))
            {
                _camera_mode = CAMERA_MODE.PLAY;
            }
            break;

        case CAMERA_MODE.STAGE_VIEW:
            if (_stage_view_camera.isfinish( ))
            {
                _camera_mode = CAMERA_MODE.PLAY;
            }
            break;
        }
    }
Example #2
0
        void Start()
        {
            g_NPCControlManager = FindObjectOfType <NPCControlManager>();
            if (Target != null)
            {
                SetThirdPersonView();
                CurrentMode = CAMERA_MODE.THIRD_PERSON;
            }
            else
            {
                switch (CurrentMode)
                {
                case CAMERA_MODE.ISOMETRIC:
                    SetIsometricView();
                    break;

                case CAMERA_MODE.FIRST_PERSON:
                    SetFirstPersonView();
                    break;

                case CAMERA_MODE.THIRD_PERSON:
                    SetThirdPersonView();
                    break;
                }
            }
            if (g_NPCControlManager == null)
            {
                Debug.Log("NPCCamController --> No NPCControlManager with the NPCCamController enabled");
            }
        }
Example #3
0
    // =================================
    // ========== CONSTRUCTOR ==========
    // =================================
    public CameraSystem()
    {
        // ---------- VARIABLES INITIALIZATION ----------
        cameraGO       = _cameraGO.First();
        pivot          = cameraGO.transform.parent.gameObject;
        camera         = cameraGO.GetComponent <Camera>();
        cameraSettings = cameraGO.GetComponent <CameraSettings>();
        cameraMode     = cameraSettings.mode;

        // ---------- SETUP BASED ON MODE ----------

        switch (cameraMode)
        {
        case CAMERA_MODE.FIXED:
            break;

        case CAMERA_MODE.INSPECTION:
            break;

        case CAMERA_MODE.GALLERY:
            if (_galleryManagerGO.Count == 0)
            {
                throw new ArgumentNullException("No gallery manager in scene, cannot setup camera accordingly");
            }
            setupCameraForGallery();
            break;
        }
    }
Example #4
0
 void Awake( )
 {
     _play_camera       = new PlayCamera( );
     _event_camera      = new EventCamera( );
     _stage_view_camera = new StageViewCamera( );
     _camera_mode       = CAMERA_MODE.PLAY;
     _camera_slider     = GameObject.Find("CameraSlider");
 }
Example #5
0
        public void setMode(CAMERA_MODE mode)
        {
            if (mode == activeMode)
            {
                return;
            }
            activeMode = mode;
            //		if (activeMode != CAMERA_MODE.DISABLED)
            //			PlayerPrefs.SetInt ("cameraMode", (int)activeMode);
            switch (mode)
            {
            case CAMERA_MODE.DISABLED:
                leftCamera.gameObject.SetActive(false);
                rightCamera.gameObject.SetActive(false);
                splitCamera.gameObject.SetActive(false);
                break;

            case CAMERA_MODE.SINGLE:
                leftCamera.gameObject.SetActive(false);
                rightCamera.gameObject.SetActive(false);
                splitCamera.gameObject.SetActive(true);
                UnityEngine.XR.XRSettings.enabled = false;
                //UnityEngine.VR.VRSettings.loadedDevice = UnityEngine.VR.VRDeviceType.None;

                uiCameraSub.gameObject.SetActive(false);
                uiCameraMain.rect = new Rect(0, 0, 1, 1);
                break;

            case CAMERA_MODE.UNITY_VR:
                leftCamera.gameObject.SetActive(false);
                rightCamera.gameObject.SetActive(false);
                splitCamera.gameObject.SetActive(true);
                // UnityEngine.XR.XRSettings.supportedDevices = string.Split(UnityEngine.XR.XRSettings.supportedDevices, StringSplitOptions.None);
                UnityEngine.XR.XRSettings.enabled = true;

                uiCameraSub.gameObject.SetActive(false);
                uiCameraMain.rect = new Rect(0, 0, 1, 1);
                break;

            case CAMERA_MODE.DUAL:
                leftCamera.gameObject.SetActive(true);
                rightCamera.gameObject.SetActive(true);
                if (splitCamera != leftCamera)                //TrinusCamera attached to external camera case
                {
                    splitCamera.gameObject.SetActive(false);
                }
                //UnityEngine.VR.VRSettings.enabled = false;
                //UnityEngine.VR.VRSettings.loadedDevice = UnityEngine.VR.VRDeviceType.None;

                uiCameraSub.gameObject.SetActive(true);
                uiCameraSub.gameObject.SetActive(true);
                uiCameraSub.rect  = new Rect(0.5f, 0, 0.5f, 1);
                uiCameraMain.rect = new Rect(0, 0, 0.5f, 1);
                break;
            }
            setFov(getFov());
        }
Example #6
0
        public void UpdateCameraMode(CAMERA_MODE mode)
        {
            bool noTarget = false;

            CurrentMode = mode;
            switch (CurrentMode)
            {
            case CAMERA_MODE.FREE:
                if (Target != null)
                {
                    Target.Body.Navigation = NAV_STATE.DISABLED;
                    SetThirdPersonView();
                }
                //g_NPCControlManager.SetIOTarget(null);
                break;

            case CAMERA_MODE.FIRST_PERSON:
                if (Target != null)
                {
                    Target.Body.Navigation = NAV_STATE.DISABLED;
                    SetFirstPersonView();
                    //g_NPCControlManager.SetIOTarget(Target);
                }
                else
                {
                    noTarget = true;
                }
                break;

            case CAMERA_MODE.THIRD_PERSON:
                if (Target != null)
                {
                    Target.Body.Navigation = NAV_STATE.DISABLED;
                    SetThirdPersonView();
                }
                else
                {
                    noTarget = true;
                }
                break;

            case CAMERA_MODE.ISOMETRIC:
                if (Target != null)
                {
                    Target.Body.Navigation = NAV_STATE.STEERING_NAV;
                }
                SetIsometricView();
                break;
            }
            if (noTarget)
            {
                //g_NPCControlManager.SetIOTarget(null);
                CurrentMode = CAMERA_MODE.FREE;
                Debug.Log("NPCCamControlelr --> No target agent set, camera stays in FREE mode.");
            }
        }
    /**
     *  Esta función cambia la configuración de la cámara dependiendo de si estamos en el modo de apuntado o en el modo normal
     */
    private void SetCameraMode(CAMERA_MODE mode)
    {
        switch (mode)
        {
        case CAMERA_MODE.BASE:
        {         // Esta será la configuración de la cámara cuando el personaje está andando
                  // Top Orbit
            cfl.m_Orbits[0].m_Height = 4.5f;
            cfl.m_Orbits[0].m_Radius = 1.75f;

            // Middle Orbit
            cfl.m_Orbits[1].m_Radius = 4f;

            // Bottom Orbit
            cfl.m_Orbits[2].m_Height = 1.0f;
            cfl.m_Orbits[2].m_Radius = 4.0f;

            // Rigs: 0-Top, 1-Middle, 2-Botton
            cfl.GetRig(0).GetCinemachineComponent <CinemachineComposer>().m_ScreenX = 0.5f;
            cfl.GetRig(1).GetCinemachineComponent <CinemachineComposer>().m_ScreenX = 0.5f;
            cfl.GetRig(2).GetCinemachineComponent <CinemachineComposer>().m_ScreenX = 0.5f;

            pp_cg.enabled.value    = true;
            pp_cg.saturation.value = -55;
            pp_ld.intensity.value  = -55f;

            InvokeRepeating("ShowPostProcessFX", 0, 0.03f);
            break;
        }

        case CAMERA_MODE.HIDE:       // Esta será la configuración de la cámara en el modo de apuntado
            // Top Ring
            cfl.m_Orbits[0].m_Height = 4.5f;
            cfl.m_Orbits[0].m_Radius = 3.0f;

            // Middle Ring
            cfl.m_Orbits[1].m_Radius = 6f;

            // Bottom Ring
            cfl.m_Orbits[2].m_Height = 1.0f;
            cfl.m_Orbits[2].m_Radius = 6.0f;

            cfl.GetRig(0).GetCinemachineComponent <CinemachineComposer>().m_ScreenX = 0.5f;
            cfl.GetRig(1).GetCinemachineComponent <CinemachineComposer>().m_ScreenX = 0.5f;
            cfl.GetRig(2).GetCinemachineComponent <CinemachineComposer>().m_ScreenX = 0.5f;


            pp_cg.enabled.value    = true;
            pp_cg.saturation.value = 10;
            pp_ld.intensity.value  = 0.0f;
            InvokeRepeating("HidePostProcessFX", 0, 0.03f);
            break;

        default: break;
        }
    }
Example #8
0
    // ============================
    // ========== HELPER ==========
    // ============================
    private bool hasStateChanged()
    {
        bool stateChanged = false;

        if (cameraMode != cameraSettings.mode)
        {
            cameraMode   = cameraSettings.mode;
            stateChanged = true;
        }
        return(stateChanged);
    }
Example #9
0
//		[Tooltip("When using the auto camera switch in TrinusProcessor, the newly selected camera will be offset to look on this angle. This avoids having to call TrinusProcessor.resetView(float)")]
//		public float defaultViewAngle = 0;

        void Awake()
        {
            defaultRotation    = new Vector3(transform.localEulerAngles.x, transform.localEulerAngles.y, transform.localEulerAngles.z);
            transform.position = new Vector3(transform.position.x, transform.position.y - neckHeight, transform.position.z);

            Transform t = transform.FindChild("LeftCamera");

            if (t != null)
            {
                leftCamera      = (Camera)t.GetComponent <Camera> ();
                t.localPosition = new Vector3(t.localPosition.x, neckHeight, t.localPosition.z);
            }
            t = transform.FindChild("RightCamera");
            if (t != null)
            {
                rightCamera     = (Camera)t.GetComponent <Camera> ();
                t.localPosition = new Vector3(t.localPosition.x, neckHeight, t.localPosition.z);
            }
            t = transform.FindChild("SplitCamera");
            if (t != null)
            {
                splitCamera     = (Camera)t.GetComponent <Camera> ();
                t.localPosition = new Vector3(t.localPosition.x, neckHeight, t.localPosition.z);
            }

            if (splitCamera == null && transform.GetComponent <Camera>() != null)
            {
                //TrinusCamera attached to a camera, ignore children and use that one as main
                splitCamera = transform.GetComponent <Camera>();
                //TODO spawn new left/right cams
                if (leftCamera == null)
                {
                    leftCamera = splitCamera;
                }
                if (rightCamera == null)
                {
                    rightCamera = splitCamera;
                }
                defaultMode = CAMERA_MODE.SINGLE;
                Debug.Log("TrinusCamera using external camera (" + splitCamera + "). Switching to single camera mode");
            }

            uiCameraMain = GameObject.Find("TrinusUICamera").GetComponent <Camera>();
            uiCameraSub  = uiCameraMain.transform.FindChild("Camera").GetComponent <Camera> ();

            //int savedMode = PlayerPrefs.GetInt ("cameraMode", (int)defaultMode);
            //setMode ((CAMERA_MODE)savedMode);
            //setFov (getFov ());
            setMode(defaultMode);
        }
Example #10
0
    public CAMERA_MODE Change()
    {
        if (_mode == CAMERA_MODE.CAMERA_MODE_FIRST_PERSON)
        {
            _mode = CAMERA_MODE.CAMERA_MODE_MAIN;
            Change(_mode);
        }
        else if (_mode == CAMERA_MODE.CAMERA_MODE_MAIN)
        {
            _mode = CAMERA_MODE.CAMERA_MODE_FIRST_PERSON;
            Change(_mode);
        }

        return(_mode);
    }
Example #11
0
 public void Change(CAMERA_MODE changeMode)
 {
     if (changeMode == CAMERA_MODE.CAMERA_MODE_MAIN)
     {
         _nrcSceneLoader.MainCamera.gameObject.SetActive(true);
         _nrcSceneLoader.FirstPersonCamera.gameObject.SetActive(false);
         _playerController.Laser.SetActive(true);
     }
     else if (changeMode == CAMERA_MODE.CAMERA_MODE_FIRST_PERSON)
     {
         _nrcSceneLoader.FirstPersonCamera.gameObject.SetActive(true);
         _nrcSceneLoader.MainCamera.gameObject.SetActive(false);
         _playerController.Laser.SetActive(false);
     }
 }
Example #12
0
        public void UpdateCamera()
        {
            bool failed = false;

            switch (CurrentMode)
            {
            case CAMERA_MODE.FREE:
                HandleFreeCamera();
                break;

            case CAMERA_MODE.FIRST_PERSON:
                if (Target == null)
                {
                    failed = true;
                }
                else
                {
                    if (!Target.Body.IsIdle)
                    {
                        SetFirstPersonView();
                    }
                }
                break;

            case CAMERA_MODE.THIRD_PERSON:
                if (Target == null)
                {
                    failed = true;
                }
                else
                {
                    if (!Target.Body.IsIdle || CloseUp)
                    {
                        SetThirdPersonView();
                    }
                }
                break;

            case CAMERA_MODE.ISOMETRIC:
                HandleIsometricCamera();
                break;
            }
            if (failed)
            {
                Debug.Log("NPCCamController --> Can't set this mode without an NPC target");
                CurrentMode = CAMERA_MODE.FREE;
            }
        }
Example #13
0
 public void useStageViewCamera( )
 {
     _stage_view_camera.callStageViewCamera(STAGE_VIEW_START, STAGE_VIEW_LIST);
     _camera_mode = CAMERA_MODE.STAGE_VIEW;
 }
Example #14
0
 public void useEventCamera(Vector3 target, Vector3 pos)
 {
     _event_camera.callEventCamera(target, pos);
     _camera_mode = CAMERA_MODE.EVENT;
 }
Example #15
0
        public void setSphericalCamera(SphericalCamera cam)
        {
            camera = cam;
            camera_mode = CAMERA_MODE.SPHERICAL_CAMERA;

            refreshView();
        }
Example #16
0
        public void setCarCamera(CarCamera cam)
        {
            camera = cam;
            camera_mode = CAMERA_MODE.CAR_CAMERA;

            refreshView();
        }