예제 #1
0
 void UpdateStates()
 {
     position = gps.GetPosition();
     if (_slices != slices)
     {
         normalVectors = new Vector3[slices];
         freeVectors   = new Vector3[slices];
         isFree        = new bool[slices];
         _slices       = slices;
     }
 }
예제 #2
0
    void FixedUpdate()
    {
        if (win)
        {
            userControl.enabled = false;
            car.Move(1f, 0f, 0f, 1f);
            return;
        }

        if (accel > 0)
        {
            steering = Vector3.Cross(transform.forward, direction.normalized).y;
        }
        if (!userControl.Using)
        {
            if (newLine)
            {
                newLine    = false;
                linePoint  = gps.GetPosition();
                lineVector = (destination.GetPosition() - gps.GetPosition()).normalized;
            }
            car.Move(steering, accel, accel, handbreak);
        }
        else
        {
            newLine = true;
        }
    }
예제 #3
0
    void Update()
    {
        CalculateVertices(lasers.Vectors, lasers.Collisions);
        // Update values
        position = gps.GetPosition();

        switch (state)
        {
        case CarState.Free:
            FollowPath();
            break;

        case CarState.Wall:
            FollowWall();
            break;

        case CarState.Corner:
            Backtrack();
            break;

        default:
            break;
        }
    }
예제 #4
0
 void Update()
 {
     transform.position = gps.GetPosition() + offset;
 }