示例#1
0
	// LoadSnapshot
	bool LoadSnapshot(string snapshotName)
	{
		float f = 0;
		
		PresetManager.SetCurrentPreset(snapshotName);
		
		if(CameraController != null)
		{
			if(PresetManager.GetPropertyFloat("IPD", ref f) == true)
				CameraController.SetIPD(f);
		
			if(PresetManager.GetPropertyFloat("PREDICTION", ref f) == true)
				OVRDevice.SetPredictionTime(0, f);
		
			if(PresetManager.GetPropertyFloat("FOV", ref f) == true)
				CameraController.SetVerticalFOV(f);
		
			if(PresetManager.GetPropertyFloat("HEIGHT", ref f) == true)
			{
				Vector3 neckPosition = Vector3.zero;
				CameraController.GetNeckPosition(ref neckPosition);
				neckPosition.y = f;
				CameraController.SetNeckPosition(neckPosition);
			}

			float Dk0 = 0.0f;
			float Dk1 = 0.0f;
			float Dk2 = 0.0f;
			float Dk3 = 0.0f;
			CameraController.GetDistortionCoefs(ref Dk0, ref Dk1, ref Dk2, ref Dk3);
		
			if(PresetManager.GetPropertyFloat("DISTORTIONK0", ref f) == true)
				Dk0 = f;
			if(PresetManager.GetPropertyFloat("DISTORTIONK1", ref f) == true)
				Dk1 = f;
			if(PresetManager.GetPropertyFloat("DISTORTIONK2", ref f) == true)
				Dk2 = f;
			if(PresetManager.GetPropertyFloat("DISTORTIONK3", ref f) == true)
				Dk3 = f;
		
			CameraController.SetDistortionCoefs(Dk0, Dk1, Dk2, Dk3);
		
		}
		
		if(PlayerController != null)
		{
			if(PresetManager.GetPropertyFloat("SPEEDMULT", ref f) == true)
				PlayerController.SetMoveScaleMultiplier(f);

			if(PresetManager.GetPropertyFloat("ROTMULT", ref f) == true)
				PlayerController.SetRotationScaleMultiplier(f);
		}
			
		return true;
	}
    /// <summary>
    /// Loads the snapshot.
    /// </summary>
    /// <returns><c>true</c>, if snapshot was loaded, <c>false</c> otherwise.</returns>
    /// <param name="snapshotName">Snapshot name.</param>
    bool LoadSnapshot(string snapshotName)
    {
        float f = 0;

        PresetManager.SetCurrentPreset(snapshotName);

        if (CameraController != null)
        {
            if (PresetManager.GetPropertyFloat("IPD", ref f) == true)
            {
                CameraController.SetIPD(f);
            }

            if (PresetManager.GetPropertyFloat("PREDICTION", ref f) == true)
            {
                OVRDevice.SetPredictionTime(f);
            }

            if (PresetManager.GetPropertyFloat("FOV", ref f) == true)
            {
                CameraController.SetVerticalFOV(f);
            }

            if (PresetManager.GetPropertyFloat("HEIGHT", ref f) == true)
            {
                Vector3 neckPosition = Vector3.zero;
                CameraController.GetNeckPosition(ref neckPosition);
                neckPosition.y = f;
                CameraController.SetNeckPosition(neckPosition);
            }
        }

        if (PlayerController != null)
        {
            if (PresetManager.GetPropertyFloat("SPEEDMULT", ref f) == true)
            {
                PlayerController.SetMoveScaleMultiplier(f);
            }

            if (PresetManager.GetPropertyFloat("ROTMULT", ref f) == true)
            {
                PlayerController.SetRotationScaleMultiplier(f);
            }
        }

        return(true);
    }