Browse Source

Adapt coin rotation based on horizontal/vertical direction

Till Steinert 2 years ago
parent
commit
ab18bd56fd
1 changed files with 5 additions and 2 deletions
  1. 5 2
      Assets/Coin/CoinCreation.cs

+ 5 - 2
Assets/Coin/CoinCreation.cs

@@ -59,6 +59,8 @@ public class CoinCreation : MonoBehaviour
                 float space_x = 0; //default
                 float space_z = 0; //default
 
+                Vector3 rotationVector = new Vector3(0f, 0f, 0f);
+
                 if (start_point.slalom || (start_point.slalom && end_point.slalom))
                 {
                     //TODO Was muss beim schiefen verteilen für den Slalom angepasst werden? z.B. stepsize?
@@ -68,11 +70,13 @@ public class CoinCreation : MonoBehaviour
                 {
                     space_x = distance_x / stepsize;
                     Debug.Log("Coin-Creation: Place Coins along x axis.");
+                    rotationVector = new Vector3(0f, 0f, 90f);
                 }
                 if (distance_z > 0) // wenn entlang der z Richung verteilt wird
                 {
                     space_z = distance_z / stepsize;
                     Debug.Log("Coin-Creation: Place Coins along z axis.");
+                    rotationVector = new Vector3(0f, 90f, 90f);
                 }
 
                 for (int i = 0; i < stepsize; ++i)
@@ -85,8 +89,7 @@ public class CoinCreation : MonoBehaviour
                     //Coin erstellen
                     coin = coinPool.GetItem();
                     coin.transform.position = coin_position;
-                    coin.transform.rotation = Quaternion.Euler(0f, 0f, 90f);
-
+                    coin.transform.rotation = Quaternion.Euler(rotationVector);
                     if (((i + 1) == stepsize) && (coin != null)) { Debug.Log("CoinCreation: Coin placement finished."); }
                 }