Ejemplo n.º 1
0
        public override void OnPaint(IGraphics graphics)
        {
            DebugDrawer.DebugDrawRect(enemyInfo.GetGuessPositionHistory(10), 10, System.Drawing.Brushes.Blue, graphics);
            DebugDrawer.DebugDrawRect(enemyInfo.GetGuessPositionHeading(10), 10, System.Drawing.Brushes.Green, graphics);
            DebugDrawer.DebugDrawRect(enemyInfo.GetGuessPositionEducated(10), 10, System.Drawing.Brushes.Red, graphics);

            DebugDrawer.DebugDrawLine(this.Position, enemyInfo.Bearings.GetCurrent() + HeadingRadians, 20, System.Drawing.Pens.Red, graphics);
            DebugDrawer.DebugDrawLine(this.Position, MiscHelper.GetAngleBetweenPositions(Position, enemyInfo.GetGuessPositionEducated(10)), 20, System.Drawing.Pens.Green, graphics);
        }
        private void followEnemyRobot()
        {
            robot.MaxVelocity = Rules.MAX_VELOCITY;

            Coordinates futurePos     = info.GetGuessPositionEducated(predictionFollowTicks);
            double      positionAngle = MiscHelper.GetAngleBetweenPositions(robot.Position, futurePos);
            double      turnAngle     = Utils.NormalRelativeAngle(positionAngle - Utils.NormalRelativeAngle(robot.HeadingRadians));

            robot.SetTurnRightRadians(turnAngle);
        }
Ejemplo n.º 3
0
        public void EveryTurn()
        {
            Coordinates mePosition = robot.Position;


            double enemyCurrDistance = (info.Position.GetCurrent() - mePosition).Distance();
            double bulletPower       = determineBulletPower(enemyCurrDistance);
            double travelTime        = getBulletTravelTime(bulletPower, enemyCurrDistance);

            Coordinates enemyFutPosition = info.GetGuessPositionEducated((int)travelTime);
            double      gunTurn          = getGunTurn(enemyFutPosition);

            robot.SetTurnGunRightRadians(gunTurn);
            if (gunTurn < maxGunTurn)
            {
                robot.SetFireBullet(bulletPower);
            }
        }