void UpdateStates() { position = gps.GetPosition(); if (_slices != slices) { normalVectors = new Vector3[slices]; freeVectors = new Vector3[slices]; isFree = new bool[slices]; _slices = slices; } }
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; } }
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; } }
void Update() { transform.position = gps.GetPosition() + offset; }