Browse Source

Upload coin creation and fix slalom

Julia Abels 2 years ago
parent
commit
261cd012b4
1 changed files with 25 additions and 2 deletions
  1. 25 2
      Assets/Coin/CoinCreation.cs

+ 25 - 2
Assets/Coin/CoinCreation.cs

@@ -65,6 +65,14 @@ public class CoinCreation : MonoBehaviour
                 {
                     //TODO Was muss beim schiefen verteilen für den Slalom angepasst werden? z.B. stepsize?
                     Debug.Log("Coin-Creation: Place Coins for Slalom.");
+
+                    /*
+                    space_x = distance_x / stepsize;
+                    space_z = distance_z / stepsize;
+                    rotationVector = new Vector3(0f, 90f, 90f);
+                    */
+
+
                 }
                 if (distance_x > 0) // wenn entlang der x Richung verteilt wird
                 {
@@ -82,9 +90,24 @@ public class CoinCreation : MonoBehaviour
                 for (int i = 0; i < stepsize; ++i)
                 {
                     //Coin-Position berechnen
-                    coin_position.x = start_point.x + i * space_x;
+                    if (start_point.x - end_point.x > 0)
+                    {
+                        coin_position.x = start_point.x - i * space_x;
+                    }
+                    if (start_point.x - end_point.x <= 0)
+                    {
+                        coin_position.x = start_point.x + i * space_x;
+                    }
+                    if (start_point.z - end_point.z > 0)
+                    {
+                        coin_position.z = start_point.z - i * space_z;
+                    }
+                    if (start_point.z - end_point.z <= 0)
+                    {
+                        coin_position.z = start_point.z + i * space_z;
+                    }
+
                     coin_position.y = 0.5f;
-                    coin_position.z = start_point.z + i * space_z;
 
                     //Coin erstellen
                     coin = coinPool.GetItem();