void ProcessEnvironmentLayer(Random r, long beginFrame, long endFrame, SceneFrameCollection frames) { var newKeyFrames = ProcessFrames(r, beginFrame, endFrame, keyFrameInterval, noiseValueInterval, new HashSet <long>(frames.Where(_ => _.Selected).Select(_ => _.FrameNumber))) .Select(_ => { var baseFrame = frames.GetFrame(_.Key); baseFrame.FrameNumber = Math.Max(_.Key + GetNoise(r, keyShiftWidth), 0); baseFrame.Gravity += _.Value.GravityWidth; baseFrame.GravityDirection += _.Value.GravityDirectionWidth; baseFrame.Selected = true; return(baseFrame); }) .ToArray(); foreach (var i in frames.Where(_ => _.Selected)) { frames.RemoveKeyFrame(i.FrameNumber); } frames.AddKeyFrame(newKeyFrames.ToLookup(_ => _.FrameNumber) .Select(_ => _.Last()) .ToList()); }
void ProcessEnvironmentLayer(Random r, long beginFrame, long endFrame, SceneFrameCollection frames) { var newKeyFrames = ProcessFrames(r, beginFrame, endFrame, keyFrameInterval, noiseValueInterval, new HashSet<long>(frames.Where(_ => _.Selected).Select(_ => _.FrameNumber))) .Select(_ => { var baseFrame = frames.GetFrame(_.Key); baseFrame.FrameNumber = Math.Max(_.Key + GetNoise(r, keyShiftWidth), 0); baseFrame.Gravity += _.Value.GravityWidth; baseFrame.GravityDirection += _.Value.GravityDirectionWidth; baseFrame.Selected = true; return baseFrame; }) .ToArray(); foreach (var i in frames.Where(_ => _.Selected)) frames.RemoveKeyFrame(i.FrameNumber); frames.AddKeyFrame(newKeyFrames.ToLookup(_ => _.FrameNumber) .Select(_ => _.Last()) .ToList()); }