reduce code duplication / allocations

This commit is contained in:
ekrctb 2019-01-26 16:16:49 +09:00
parent 1a5a238752
commit ea48d6a88a
1 changed files with 9 additions and 12 deletions

View File

@ -55,6 +55,13 @@ private void createTicks()
var minDistanceFromEnd = Velocity * 0.01;
var tickSamples = Samples.Select(s => new SampleInfo
{
Bank = s.Bank,
Name = @"slidertick",
Volume = s.Volume
}).ToList();
AddNested(new Fruit
{
Samples = Samples,
@ -107,12 +114,7 @@ private void createTicks()
{
StartTime = t,
X = X + Path.PositionAt(progress).X / CatchPlayfield.BASE_WIDTH,
Samples = new List<SampleInfo>(Samples.Select(s => new SampleInfo
{
Bank = s.Bank,
Name = @"slidertick",
Volume = s.Volume
}))
Samples = tickSamples
});
}
@ -125,12 +127,7 @@ private void createTicks()
{
StartTime = time,
X = X + Path.PositionAt(distanceProgress).X / CatchPlayfield.BASE_WIDTH,
Samples = new List<SampleInfo>(Samples.Select(s => new SampleInfo
{
Bank = s.Bank,
Name = @"slidertick",
Volume = s.Volume
}))
Samples = tickSamples
});
}