|
@@ -37,36 +37,31 @@ namespace Routes
|
|
|
|
|
|
var difStartFirstTurn = firstTurnPos - startTransform.position;
|
|
var difStartFirstTurn = firstTurnPos - startTransform.position;
|
|
Vector3 bikeDirection = Vector3.zero;
|
|
Vector3 bikeDirection = Vector3.zero;
|
|
- Vector3 bikeRotation = Vector3.zero;
|
|
|
|
|
|
|
|
- if (difStartFirstTurn.x > 1 || difStartFirstTurn.z > 1)
|
|
|
|
|
|
+ if (difStartFirstTurn.x > 1)
|
|
{
|
|
{
|
|
- bikeDirection = startTransform.right;
|
|
|
|
- bikeRotation = new Vector3(0, -90, 0);
|
|
|
|
|
|
+ bikeDirection = new Vector3(-1, 0, 0);
|
|
}
|
|
}
|
|
- /*else if (difStartFirstTurn.z > 1)
|
|
|
|
|
|
+ else if (difStartFirstTurn.z > 1)
|
|
{
|
|
{
|
|
- bikeDirection = startTransform.forward;
|
|
|
|
- bikeRotation = new Vector3(0, -180, 0);
|
|
|
|
- }*/
|
|
|
|
- else if (difStartFirstTurn.x < -1 || difStartFirstTurn.z < -1)
|
|
|
|
|
|
+ bikeDirection = new Vector3(0, 0, -1);
|
|
|
|
+ }
|
|
|
|
+ else if (difStartFirstTurn.x < -1)
|
|
{
|
|
{
|
|
- bikeDirection = -startTransform.right;
|
|
|
|
- bikeRotation = new Vector3(0, 90, 0);
|
|
|
|
|
|
+ bikeDirection = new Vector3(1, 0, 0);
|
|
|
|
+
|
|
}
|
|
}
|
|
- /*else if (difStartFirstTurn.z < -1)
|
|
|
|
|
|
+ else if (difStartFirstTurn.z < -1)
|
|
{
|
|
{
|
|
- bikeDirection = -startTransform.forward;
|
|
|
|
- bikeRotation = new Vector3(0, 180, 0);
|
|
|
|
- }*/
|
|
|
|
|
|
+ bikeDirection = new Vector3(0, 0, 1);
|
|
|
|
+ }
|
|
|
|
|
|
bicycleGameObject = bicycle.gameObject;
|
|
bicycleGameObject = bicycle.gameObject;
|
|
- bicycleGameObject.transform.SetPositionAndRotation(
|
|
|
|
- startTransform.position + bikeDirection * 12,
|
|
|
|
- Quaternion.Euler(startRotationEuler + bikeRotation));
|
|
|
|
|
|
+ bicycleGameObject.transform.position =
|
|
|
|
+ startTransform.position + bikeDirection * 12;
|
|
|
|
+ bicycleGameObject.transform.LookAt(startTransform);
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
private void OnOnFinishPassed()
|
|
private void OnOnFinishPassed()
|
|
{
|
|
{
|
|
//bicycle.enabled = false;
|
|
//bicycle.enabled = false;
|