Exemplo n.º 1
0
    public bool Drive(int i)
    {
        //Rubberbanding

        int DesiredRankCalculated = (from number in CalculatedRanksList
                                     orderby number descending
                                     select number).Skip(AIRacerList[i].DesiredRank - 1).First();

        //select number).Skip(1).First();

        //If entire Waypoint Behind Desired Rank, Speed Up
        if (AIRacerList[i].CalculatedRank < DesiredRankCalculated)
        {
            AIRacerList[i].CurrentMaxSpeed = AIRacerList[i].RubberbandingSpeed;
        }
        else
        {
            AIRacerList[i].CurrentMaxSpeed = AIRacerList[i].OriginalMaxSpeed;
        }


        //Set Current Waypoint
        AIRacerList[i].CurrentWaypoint = WaypointScript.CheckWaypointCollision(WaypointScript.WaypointList[AIRacerList[i].CurrentWaypoint], true,
                                                                               AIRacerList[i].CurrentPosition, AIRacerList[i].CurrentWaypoint, i);

        //DRIVE
        WaypointScript.SeekWaypoint(i, WaypointScript.WaypointList[AIRacerList[i].CurrentWaypoint]);

        return(true);
    }
Exemplo n.º 2
0
    public bool Drive()
    {
        //If Rubberbanding Do X, for now do Y
        TheFearMachine.CurrentMaxSpeed = TheFearMachine.OriginalMaxSpeed;
        TheFearMachine.CurrentWaypoint = WaypointScript.CheckWaypointCollision(WaypointScript.WaypointList[TheFearMachine.CurrentWaypoint], false,
                                                                               TheFearMachine.CurrentPosition, TheFearMachine.CurrentWaypoint);
        //Drive Calculation
        TheFearMachine.DesiredPosition = WaypointScript.WaypointList[TheFearMachine.CurrentWaypoint].CentrePosition;
        TheFearMachine.SteeringForce   = AISteeringBehaviour.SeekOrFlee(TheFearMachine.CurrentPosition, TheFearMachine.DesiredPosition,
                                                                        TheFearMachine.CurrentMaxSpeed, TheFearMachine.CurrentDirection, true);

        return(true);
    }