Browse Source

errors fixed

lisa 2 years ago
parent
commit
499dd9aa4c
1 changed files with 9 additions and 4 deletions
  1. 9 4
      Assets/Coin/CoinCollection.cs

+ 9 - 4
Assets/Coin/CoinCollection.cs

@@ -1,22 +1,26 @@
 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
+using Pools;
 
 public class CoinCollection : MonoBehaviour
 {
-    public GameObject coinPool;
+    public CoinPool coinPool;
+    public CoinCreation spawn;
+
     // Start is called before the first frame update
     void Start()
     {
         coinPool = GameObject.FindGameObjectWithTag("CoinPool").GetComponent<CoinPool>();
+        spawn = GameObject.FindGameObjectWithTag("Route").GetComponent<CoinCreation>();
     }
 
     // Update is called once per frame
     void Update()
     {
-        
+
     }
-    
+
     //Keep count of collisions with player
     private void OnTriggerEnter(Collider other)
     {
@@ -27,8 +31,9 @@ public class CoinCollection : MonoBehaviour
             // Increase Hit Counter
             var bike = other.gameObject;
             bike.GetComponent<PlayerStats>().IncreaseCoinCounter();
-
             coinPool.ReturnToPool(gameObject);
+            //sobald ein coin eingesammelt einen neuen erstellen/platzieren
+            spawn.UpdateCoins();
         }
     }
 }