Esempio n. 1
0
        void CreateScriptableObject(CameraScript cameraScript)
        {
            CameraScriptableObj asset = ScriptableObject.CreateInstance <CameraScriptableObj>();

            asset.cameraData = cameraScript.GetCameraData();

            AssetDatabase.CreateAsset(asset, "Assets/Resources/Camera/CameraData.asset");
            AssetDatabase.SaveAssets();
        }
Esempio n. 2
0
        public void SetCameraSettings(CameraScriptableObj cameraData)
        {
            //playerTarget = FindObjectOfType<PlayerView>().gameObject;
            //platformTarget = GameObject.FindWithTag("Platform").gameObject;

            //if(playerTarget != null && platformTarget != null)
            //{
            //    centerPoint = (playerTarget.transform.position + platformTarget.transform.position) / 2;
            //    cameraOffsetDistance = cameraObj.transform.position - centerPoint;
            //    fieldOfViewRatio = cameraObj.GetComponent<Camera>().fieldOfView /
            //                       Vector3.Distance(playerTarget.transform.position, platformTarget.transform.position);
            //    startCamera = true;
            //}

            transform.position = cameraData.cameraData.position;
            transform.rotation = cameraData.cameraData.rotation;
            cameraObj.GetComponent <Camera>().fieldOfView = cameraData.cameraData.fieldOfView;
        }