public static void AddSimpleMovementKeys <TCommand>(this ISimpleMovementRules <TCommand> factory, KeyboardController <TCommand> pool, string controllerId) where TCommand : ISimpleMovementCommand, new() { var dt = 0.1; if (controllerId == TwoPlayersId.Left) { pool.Add(Keys.W, () => new TCommand { SimpleMovement = SimpleMovement.Move(factory.LinearVelocityLimit, dt) }); pool.Add(Keys.S, () => new TCommand { SimpleMovement = SimpleMovement.Move(-factory.LinearVelocityLimit, dt) }); pool.Add(Keys.A, () => new TCommand { SimpleMovement = SimpleMovement.Rotate(factory.AngularVelocityLimit, dt) }); pool.Add(Keys.D, () => new TCommand { SimpleMovement = SimpleMovement.Rotate(-factory.AngularVelocityLimit, dt) }); } if (controllerId == TwoPlayersId.Right) { pool.Add(Keys.I, () => new TCommand { SimpleMovement = SimpleMovement.Move(factory.LinearVelocityLimit, dt) }); pool.Add(Keys.K, () => new TCommand { SimpleMovement = SimpleMovement.Move(-factory.LinearVelocityLimit, dt) }); pool.Add(Keys.J, () => new TCommand { SimpleMovement = SimpleMovement.Rotate(factory.AngularVelocityLimit, dt) }); pool.Add(Keys.L, () => new TCommand { SimpleMovement = SimpleMovement.Rotate(-factory.AngularVelocityLimit, dt) }); } }
public static void AddGripKeys <TCommand>(this IGripperRules <TCommand> rules, KeyboardController <TCommand> pool, string controllerId) where TCommand : IGripperCommand, new() { if (controllerId == TwoPlayersId.Left) { pool.Add(Keys.R, () => new TCommand { GripperCommand = GripperAction.Grip }); pool.Add(Keys.F, () => new TCommand { GripperCommand = GripperAction.Release }); } if (controllerId == TwoPlayersId.Right) { pool.Add(Keys.P, () => new TCommand { GripperCommand = GripperAction.Grip }); pool.Add(Keys.OemSemicolon, () => new TCommand { GripperCommand = GripperAction.Release }); } }