Beispiel #1
0
 public void GateExited(GateDetector gate)
 {
     if (currentGate == gate)
     {
         gateIsEntered--;
         if (gateIsEntered == 0)
         {
             if (propsEntered.Count == Props.Length && course.gates[coursePosition] == currentGate)
             {
                 coursePosition++;
                 gatesPassed++;
                 if (gatesPassed > course.gates.Length)
                 {
                     if (lapTime < bestTime[course])
                     {
                         bestTime[course] = lapTime;
                     }
                     lapTime     = 0f;
                     gatesPassed = 1;
                 }
                 coursePosition %= course.gates.Length;
                 Debug.Log("Course Position: " + coursePosition);
             }
             propsEntered.Clear();
         }
     }
 }
Beispiel #2
0
 public void Reset()
 {
     Inputs.Reset();
     if (Inputs.playerNum < 0)
     {
         Inputs.currentWaypoint = startPos;
         setAICourse();
     }
     else
     {
         if (ResetAI)
         {
             SetNumAI(multirotors.Count, this);
         }
         if (course != null)
         {
             warmUp  = true;
             lapTime = 3f;
         }
     }
     RigidBody.angularVelocity = Vector3.zero;
     RigidBody.velocity        = Vector3.zero;
     transform.position        = startPos;
     transform.rotation        = startRot;
     axisPID      = new Int16[3];
     maxV         = 11.1f;
     totalCurrent = 0f;
     motorSpeeds  = new float[mixer.GetLength(0)];
     InitPidController();
     isCollided     = 0;
     currentGate    = null;
     gateIsEntered  = 0;
     coursePosition = 0;
     gatesPassed    = 0;
 }
Beispiel #3
0
    public void GateEntered(GateDetector gate)
    {
        if (gateIsEntered == 0)
        {
            currentGate = gate;
        }

        if (currentGate == gate)
        {
            gateIsEntered++;
        }
    }