add update method to code blocks for clarity
continuous-integration/drone/push Build is passing Details

main
Evan Hemsley 2020-07-27 14:12:47 -07:00
parent f84c7d1627
commit 57fb02daf2
1 changed files with 52 additions and 49 deletions

View File

@ -81,8 +81,8 @@ Next, in a separate block, let's consolidate our MotionMessages per Entity.
private readonly Dictionary<Entity, Vector2> _moveAmounts = new Dictionary<Entity, Vector2>();
...
public override void Update(double dt)
{
_spatialHash.Clear();
_moveAmounts.Clear();
@ -236,6 +236,8 @@ namespace PongFE.Engines
Now, in the final block of our **MotionEngine**, we can perform our collision tests and send out our messages.
```cs
public override void Update(double dt)
{
...
foreach (var entity in TrackedEntities)
@ -276,6 +278,7 @@ Now, in the final block of our **MotionEngine**, we can perform our collision te
SendMessage(new UpdatePositionMessage(entity, projectedPosition));
}
}
```
Here, we go over everything with a Position and Collision component, sweep test for collisions, and send appropriate Collision and UpdatePosition messages accordingly.