コード例 #1
0
        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;
        }
コード例 #2
0
ファイル: BotState.cs プロジェクト: KingLebron/robocode
 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;
 }