using Encompass; using PongFE.Components; using PongFE.Messages; namespace PongFE.Engines { [Sends(typeof(MotionMessage))] [QueryWith(typeof(PositionComponent), typeof(VelocityComponent))] public class VelocityEngine : Engine { public override void Update(double dt) { foreach (var entity in TrackedEntities) { ref readonly var velocityComponent = ref GetComponent(entity); SendMessage(new MotionMessage(entity, velocityComponent.Velocity * (float)dt)); } } } }