20 lines
510 B
C#
20 lines
510 B
C#
using Encompass;
|
|
using PongFE.Components;
|
|
using PongFE.Messages;
|
|
|
|
namespace PongFE.Engines
|
|
{
|
|
[Receives(typeof(UpdateVelocityMessage))]
|
|
[Writes(typeof(VelocityComponent))]
|
|
public class UpdateVelocityEngine : Engine
|
|
{
|
|
public override void Update(double dt)
|
|
{
|
|
foreach (ref readonly var message in ReadMessages<UpdateVelocityMessage>())
|
|
{
|
|
SetComponent(message.Entity, new VelocityComponent(message.Velocity));
|
|
}
|
|
}
|
|
}
|
|
}
|