add update method to code blocks for clarity
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
f84c7d1627
commit
57fb02daf2
|
@ -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>();
|
private readonly Dictionary<Entity, Vector2> _moveAmounts = new Dictionary<Entity, Vector2>();
|
||||||
|
|
||||||
...
|
public override void Update(double dt)
|
||||||
|
{
|
||||||
_spatialHash.Clear();
|
_spatialHash.Clear();
|
||||||
_moveAmounts.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.
|
Now, in the final block of our **MotionEngine**, we can perform our collision tests and send out our messages.
|
||||||
|
|
||||||
```cs
|
```cs
|
||||||
|
public override void Update(double dt)
|
||||||
|
{
|
||||||
...
|
...
|
||||||
|
|
||||||
foreach (var entity in TrackedEntities)
|
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));
|
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.
|
Here, we go over everything with a Position and Collision component, sweep test for collisions, and send appropriate Collision and UpdatePosition messages accordingly.
|
||||||
|
|
Loading…
Reference in New Issue