internal ISceneCacheInfo ExtractSceneCacheInfo(bool forceOpen) { if (IsSceneCacheOpened()) { return(m_sceneCacheInfo); } if (!forceOpen) { return(null); } SceneCacheData tempSceneCache = SceneCacheData.Open(m_sceneCacheFilePath); if (!tempSceneCache) { return(null); } SceneCacheInfo ret = new SceneCacheInfo(); UpdateSceneCacheInfo(ret, tempSceneCache); tempSceneCache.Close(); return(ret); }
private static int CalculateFrameByRound(float time, SceneCacheInfo scInfo, LimitedAnimationController controller) { int frame = Mathf.RoundToInt(time * scInfo.sampleRate); frame = controller.Apply(frame); frame = Mathf.Clamp(frame, 0, scInfo.numFrames - 1); return(frame); }
private static void UpdateSceneCacheInfo(SceneCacheInfo scInfo, SceneCacheData scData) { Assert.IsTrue(scData); scInfo.numFrames = scData.GetNumScenes(); scInfo.sampleRate = scData.GetSampleRate(); scInfo.timeCurve = scData.GetTimeCurve(InterpolationMode.Constant); scInfo.timeRange = scData.GetTimeRange(); }