//implements abstract rectangle interface: registers updates from the agent's sensors that it is up to date with the latest environment information /*WARNING: this method is called independently from the agent update - Update(TimeSpan elapsedGameTime) - so care should be taken when using complex * structures that are modified in both (e.g. see operation on the "remaining" collection) */ public override void SensorsUpdated(int nC, RectangleRepresentation rI, CircleRepresentation cI, CollectibleRepresentation[] colI) { if (gameMode == 0) { singlePlayer.SensorsUpdated(nC, rI, cI, colI); } else { multiPlayer.SensorsUpdated(nC, rI, cI, colI); } }
public override void SensorsUpdate(RectangleRepresentation rI, CircleRepresentation cI, CollectibleRepresentation[] colI) { if (isFinished()) { return; } rectangleSingleplayer.SensorsUpdated(objectiveDiamond.Length, rI, cI, objectiveDiamond); foreach (CollectibleRepresentation diamond in colI) { if (objectiveDiamond.Length > 0 && diamond.X == objectiveDiamond[0].X && diamond.Y == objectiveDiamond[0].Y) { return; } } setFinished(); objectiveDiamond = new CollectibleRepresentation[0]; }