Пример #1
0
 public override void UpdateMovement(RobotControls controls)
 {
     if (controls.myself.currentHealth < 50 && _noclosestHealth == false)
     {
         controls.goTo(_closestHealth.currentPickupPosition);
     }
     else
     {
         if (Vector3.Distance(controls.myself.currentPosition, controls.updateBall) < 2f)
         {
             if (_noclosestPickup == false)
             {
                 controls.goTo(_closestPickup.currentPickupPosition);
             }
             else
             {
                 controls.goTo(_closestTeammate.currentPosition);
             }
         }
         else
         {
             controls.goTo(controls.updateBall);
         }
     }
 }
Пример #2
0
 public override void UpdateMovement(RobotControls controls)
 {
     if (_hasBall)
     {
         var relativeDistance = _closestEnemy.currentPosition - controls.myself.currentPosition;
         controls.goTo(controls.myself.currentPosition - relativeDistance);
     }
     else
     {
         controls.goTo(_ball);
     }
 }
Пример #3
0
 public override void UpdateMovement(RobotControls controls)
 {
     if (_canMove)
     {
         controls.goTo(_MoveVector);
         _canMove = false;
     }
 }
Пример #4
0
    public override void UpdateMovement(RobotControls controls)
    {
        #region Ball carrier exists

        if (GetBallCarrier(controls) != null)
        {
            #region I am ball carrier

            if (GetBallCarrier(controls).Value.team == controls.myself.team &&
                GetBallCarrier(controls).Value.id == controls.myself.id)
            {
                #region Powerup Exists

                powerupsVisible  = controls.updatePickup.Count > 0;
                powerupsRecalled = RecallPowerPositions(controls) != Vector3.zero;
                alliesVisible    = GetSeenRobotTarget(controls, controls.myself.currentPosition, true, true) != null;
                opponentsVisible = GetSeenRobotTarget(controls, controls.myself.currentPosition, false, true) != null;
                lowOnHealth      = controls.myself.currentHealth > curHealthThreshold;

                if ((powerupsVisible || powerupsRecalled) && (!lowOnHealth || !alliesVisible) && opponentsVisible)
                {
                    //Move towards closest powerup
                    GetClosestPowerup(controls, controls.myself.currentPosition);
                    immobilised = false;
                    //Shoot closest opponent
                    TragectoryPrediction(controls, GetSeenRobotTarget(controls, controls.myself.currentPosition, false, true));
                    if (controls.reload == 0)
                    {
                    }
                }

                #endregion

                #region Evade closest opponent

                powerupsVisible  = controls.updatePickup.Count > 0;
                powerupsRecalled = RecallPowerPositions(controls) != Vector3.zero;
                alliesVisible    = GetSeenRobotTarget(controls, controls.myself.currentPosition, true, true) != null;
                opponentsVisible = GetSeenRobotTarget(controls, controls.myself.currentPosition, false, true) != null;
                lowOnHealth      = controls.myself.currentHealth > curHealthThreshold;

                if ((!powerupsVisible && !powerupsRecalled) && (!lowOnHealth || !alliesVisible) && opponentsVisible)
                {
                    //Move away from closest opponent
                    controls.goTo(
                        GetSeenRobotTarget(controls, controls.myself.currentPosition, false, true).Value.currentPosition -
                        controls.myself.currentPosition);
                    immobilised = false;
                    //Shoot closest opponent
                    TragectoryPrediction(controls, GetSeenRobotTarget(controls, controls.myself.currentPosition, false, true));
                }

                #endregion

                #region Pass the ball

                powerupsVisible  = controls.updatePickup.Count > 0;
                powerupsRecalled = RecallPowerPositions(controls) != Vector3.zero;
                alliesVisible    = GetSeenRobotTarget(controls, controls.myself.currentPosition, true, true) != null;
                opponentsVisible = GetSeenRobotTarget(controls, controls.myself.currentPosition, false, true) != null;
                lowOnHealth      = controls.myself.currentHealth > curHealthThreshold;

                if ((lowOnHealth && alliesVisible) && opponentsVisible)
                {
                    //Pass the ball to furthest ally
                    controls.passBall(
                        GetSeenRobotTarget(controls, controls.myself.currentPosition, true, false).Value.currentPosition);
                }

                #endregion

                #region Coast clear

                powerupsVisible  = controls.updatePickup.Count > 0;
                powerupsRecalled = RecallPowerPositions(controls) != Vector3.zero;
                alliesVisible    = GetSeenRobotTarget(controls, controls.myself.currentPosition, true, true) != null;
                opponentsVisible = GetSeenRobotTarget(controls, controls.myself.currentPosition, false, true) != null;
                lowOnHealth      = controls.myself.currentHealth > curHealthThreshold;

                if (!opponentsVisible)
                {
                    if (immobilised)
                    {
                        //Stop moving
                        controls.goTo(controls.myself.currentPosition);
                        immobilised = true;
                    }
                }

                #endregion
            }

            #endregion

            #region Ally ball

            else if (GetBallCarrier(controls).Value.team == controls.myself.team)
            {
                //Move towards ball
                controls.goTo(controls.updateBall);
                immobilised = false;
                //Shoot at closest opponent to ball carrier if any
                if (GetSeenRobotTarget(controls, GetBallCarrier(controls).Value.currentPosition, false, true) != null)
                {
                    TragectoryPrediction(controls,
                                         GetSeenRobotTarget(controls,
                                                            GetBallCarrier(controls).Value.currentPosition, false, true));
                }
            }

            #endregion

            #region Opponent ball

            else if (GetBallCarrier(controls).Value.team != controls.myself.team)
            {
                //Move towards ball
                controls.goTo(controls.updateBall);
                immobilised = false;
                //Shoot at ball carrier
                TragectoryPrediction(controls,
                                     GetBallCarrier(controls));
            }

            #endregion
        }

        #endregion

        #region Anybody's ball

        else if (GetBallCarrier(controls) == null)
        {
            //Move towards ball
            controls.goTo(controls.updateBall);
            immobilised = false;
            //Shoot at closest opponent if any
            if (GetSeenRobotTarget(controls, controls.myself.currentPosition, false, true) != null)
            {
                TragectoryPrediction(controls,
                                     GetSeenRobotTarget(controls, controls.myself.currentPosition, false, true));
            }
        }

        #endregion
    }