public BotState(Robot bot, ScannedRobotEvent evnt) { var direction = bot.Heading + evnt.Bearing; this.Observer = bot; this.Energy = evnt.Energy; this.Location = Geometry.ShiftBy(bot.GetLocation(), direction, evnt.Distance, bot.GetArenaBounds()); this.Heading = evnt.Heading; this.Velocity = evnt.Velocity; this.Turn = bot.Time; }
public BotState(Robot bot, ScannedRobotEvent evnt) { double heading = bot.Heading + evnt.Bearing; this.Observer = bot; this.Energy = evnt.Energy; this.Location = bot.GetLocation().ShiftBy(heading, evnt.Distance, bot.GetArenaBounds()); if (evnt.Velocity < 0) { this.Velocity = evnt.Velocity * -1; this.Heading = Utils.NormalAbsoluteAngleDegrees(evnt.Heading + 180); } else { this.Heading = evnt.Heading; this.Velocity = evnt.Velocity; } this.Turn = bot.Time; }