You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

AgEngineEffector.cs 918B

123456789101112131415161718192021222324252627282930313233
  1. using Microsoft.Extensions.Options;
  2. using uqac_ia_aspirobot.Agent.Interfaces.Effectors;
  3. using uqac_ia_aspirobot.Agent.Interfaces.Sensors;
  4. using uqac_ia_aspirobot.Extensions;
  5. namespace uqac_ia_aspirobot.Agent.FakeEnv.Effectors
  6. {
  7. public class AgEngineEffector : IAgEngineEffector
  8. {
  9. private readonly IAgBatterySensor _agBatterySensor;
  10. private readonly AgConfig _options;
  11. public int X { get; protected set; }
  12. public int Y { get; protected set; }
  13. public AgEngineEffector(IOptions<AgConfig> options, IAgBatterySensor agBatterySensor)
  14. {
  15. _agBatterySensor = agBatterySensor;
  16. _options = options.Value;
  17. X = _options.StartX;
  18. Y = _options.StartY;
  19. }
  20. public void MoveTo(int x, int y)
  21. {
  22. _agBatterySensor.Add(this.Distance(x, y));
  23. X = x;
  24. Y = y;
  25. }
  26. }
  27. }