Beispiel #1
0
        public void DribbleBallAtGoal()
        {
            var enemyGoal      = Field.GetEnemyGoal();
            var strikeLocation = GetStrikeLocation(Ball, enemyGoal);

            Controller.Steer = Field.GetSteeringValueToward(Info, strikeLocation);
            TurnTarget       = Ball.Location;
            // Controller.Throttle = 1;

            var velocity   = Info.GetForwardVelocity();
            var turnRadius = GameValuesService.TurnRadius(velocity);
            // var threshold = 400;
            var dist = Field.GetDist(Info.Location, Ball.Location);

            if (Controller.Steer < .5 && Controller.Steer > -.5)
            {
                SpeedUp();
            }
            else if (Controller.Steer > 1 || Controller.Steer < -1)
            {
                SlowDown();
            }
            else if (Controller.Steer > 2.5 || Controller.Steer < -2.5)
            {
                TurnAroud();
            }
            else
            {
                Controller.Throttle = 1;
                Controller.Boost    = false;
            }

            // System.Console.WriteLine($"===========================");
            // System.Console.WriteLine($"Ball Dist: {dist}");
            // System.Console.WriteLine($"Steer: {Controller.Steer}");
            // System.Console.WriteLine($"Trun Radius: {turnRadius}");
            // System.Console.WriteLine($"Throttle: {Controller.Throttle}");
            // System.Console.WriteLine($"===========================");

            if (strikeLocation.Z >= GameValuesService.BallRadius * 3)
            {
                //Aerial();
            }
        }