Esempio n. 1
0
 // Use this for initialization
 void Start()
 {
     Debug.Log("Created CameraBlends");
     currentCam = new CameraBlend();
     targetCam = new CameraBlend();
     oldCam = new CameraBlend();
 }
Esempio n. 2
0
 public static void Blend( ref CameraBlend dest, ref CameraBlend camFrom, ref CameraBlend camTo, float t )
 {
     dest.pos 	= Vector3.Lerp( camFrom.pos, camTo.pos, t );
     dest.look 	= Vector3.Lerp( camFrom.look, camTo.look, t );
     dest.fov	= camFrom.fov * (1.0f-t) + camTo.fov * t;
     dest.priority 	= camTo.priority;
     dest.guid 		= camTo.guid;
 }
Esempio n. 3
0
    public CameraBlend Clone()
    {
        var blend = new CameraBlend
        {
            blendType = blendType,
            curve     = curve != null ? new AnimationCurve(curve.keys) : null
        };

        return(blend);
    }
Esempio n. 4
0
    private void Awake()
    {
        ic                 = GetComponent <InterfaceController>();
        playerCollider     = GameObject.FindGameObjectWithTag("Player").GetComponent <Collider>();
        platformController = GameObject.FindGameObjectWithTag("Platform Controller").GetComponent <PlatformController>();
        fpCameraBlend      = firstPersonCamera.GetComponent <CameraBlend>();
        topCameraBlend     = topCamera.GetComponent <CameraBlend>();

        fpCameraBlend.blendTime  = blendTime;
        topCameraBlend.blendTime = blendTime;
    }
Esempio n. 5
0
    // Use this for initialization
    void Start()
    {
        GameObject landscapeObj = GameObject.Find( "Landscape" );
        landscape = landscapeObj.GetComponent<Landscape>();

        megaTree = landscape.GetMegaTree();

        player = GameObject.Find( "Player" );

        cameraBlender = Camera.main.gameObject.GetComponent<CameraBlender>();
        cutawayCam = new CameraBlend();
    }
Esempio n. 6
0
    //选择一个合适的虚拟相机并把信息应用于unity 相机
    private void ProcessActiveCamera()
    {
        if (!isActiveAndEnabled)
        {
            return;
        }

        VirtualCameraBase previousCam = activeCamera;

        activeCamera = ActiveVirtualCamera;
        if (activeCamera != null)
        {
            if (previousCam != null && previousCam.VirtualCameraGameObject == null)
            {
                return;
            }

            //进行转移
            if (previousCam != null && previousCam != activeCamera)
            {
                float          duration = 0;
                AnimationCurve curve    = LookupBlendCurve(previousCam, activeCamera, out duration);
                activeBlend = CreateBlend(previousCam, activeCamera, curve, duration);
                //
                activeCamera.OnTransitionFromCamera(previousCam, DefaultWorldUp);
            }

            activeCamera.UpdateCameraInfo(DefaultWorldUp);
            CameraInfo info = activeCamera.CInfo;

            if (activeBlend != null)
            {
                if (activeBlend.IsComplete)
                {
                    activeBlend = null;
                    if (blendComplete != null)
                    {
                        blendComplete();
                    }
                }
                else
                {
                    activeBlend.UpdateCameraState(DefaultWorldUp);
                    info = activeBlend.CInfo;
                }
            }

            PushInfoToUnityCamera(info);
        }
    }
Esempio n. 7
0
    public bool RequestCamera( ref CameraBlend cam )
    {
        if (currentCam.priority > 20000)
            return false;

        if (cam.priority < currentCam.priority)
        {
            return false;
        }

        CameraBlend.Blend( ref targetCam, ref targetCam, ref cam, 1.0f );	// Set targetcam to cam

        return true;
    }