rewrote spawn code to be allocation-free
This commit is contained in:
parent
57a9dead0c
commit
c7b5975392
1 changed files with 5 additions and 6 deletions
|
|
@ -68,12 +68,11 @@ public static class Bunnymark
|
|||
if (IsMouseButtonDown(MouseButton.Left) && bunniesCount < MaxBunnies)
|
||||
{
|
||||
// Add a range of new bunnies
|
||||
Enumerable.Range(0, BunnyIncrement)
|
||||
.Select(_ => new Bunny())
|
||||
.ToArray()
|
||||
.CopyTo(bunnies[bunniesCount..]);
|
||||
|
||||
bunniesCount+= BunnyIncrement;
|
||||
foreach (ref var bunny in bunnies[bunniesCount..(bunniesCount+BunnyIncrement)])
|
||||
{
|
||||
bunny = new();
|
||||
}
|
||||
bunniesCount += BunnyIncrement;
|
||||
}
|
||||
else if (IsMouseButtonDown(MouseButton.Right))
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue