|
|
@ -89,15 +89,19 @@ namespace SemiColinGames { |
|
|
|
} |
|
|
|
|
|
|
|
public void Update(float modelTime, History<Input> input) { |
|
|
|
// Update player & shots.
|
|
|
|
ProfilingList<Shot> newPlayerShots = Player.Update(modelTime, input, Bounds); |
|
|
|
|
|
|
|
foreach (Shot shot in Shots) { |
|
|
|
shot.Update(modelTime); |
|
|
|
} |
|
|
|
|
|
|
|
// Add new shots.
|
|
|
|
Shots.AddRange(newPlayerShots); |
|
|
|
// TODO: inflate bounds rectangle
|
|
|
|
Shots.RemoveAll(shot => !Bounds.Intersects(shot.Bounds)); |
|
|
|
|
|
|
|
// Reap off-screen objects.
|
|
|
|
Rectangle paddedBounds = Bounds; |
|
|
|
paddedBounds.Inflate(16, 16); |
|
|
|
Shots.RemoveAll(shot => !paddedBounds.Intersects(shot.Bounds)); |
|
|
|
|
|
|
|
Debug.AddToast("shots: " + Shots.Count); |
|
|
|
} |
|
|
|