public void Update(BotsSensorsData data) { CurrentPosition = data.RobotsLocations.Where(z => z.Id == RobotId).FirstOrDefault(); OpponentPosition = data.RobotsLocations.Where(z => z.Id == OpponentRobotId).FirstOrDefault(); Details = data.Map.Where(x => x.Tag.Contains("Detail")).Select(x => new StarshipObject { DiscreteCoordinate = GetDiscretePosition((int)x.X, (int)x.Y), AbsoluteCoordinate = new Point((int) x.X, (int) x.Y), Type = x.Tag }).ToArray(); Walls = data.Map.Where(IsWall).Select(w => new StarshipObject { DiscreteCoordinate = GetDiscretePosition((int)w.X, (int)w.Y), AbsoluteCoordinate = new Point((int)w.X, (int)w.Y), Type = w.Tag }).ToArray(); }
public void Update(BotsSensorsData sensorData) { map.Update(sensorData); realRobotAngle = map.CurrentPosition.Angle; }
private void Init(BotsSensorsData data) { RobotId = data.RobotId; OpponentRobotId = RobotId == TwoPlayersId.Left ? TwoPlayersId.Right : TwoPlayersId.Left; }
public InternalMap(BotsSensorsData data) { Init(data); Update(data); }