コード例 #1
0
        protected virtual bool ShouldChangeToChasing()
        {
            var shouldSwitch      = false;
            var myGoalLocation    = Field.GetMyGoal();
            var enemyGoalLocation = Field.GetEnemyGoal();

            if (State == BotState.Defending)
            {
                var carDistToGoal = Field.GetDist(Info.Location, myGoalLocation);
                var currentZone   = Field.Zones.FirstOrDefault(z => z.Rec.IsPointWithin(Info.Location));

                if (currentZone != null && ((currentZone.IsMySide && currentZone.HasGoal) || Field.MoreThanOneZoneAway(Info.Location, Ball.Location)))
                {
                    shouldSwitch = true;
                }
            }
            else if (State == BotState.WaitingForCenter)
            {
                if (Ball.Location.X >= -893 && Ball.Location.X <= 893)
                {
                    shouldSwitch = true;
                }
            }

            return(shouldSwitch);
        }