瀏覽代碼

errors fixed

lisa 3 年之前
父節點
當前提交
499dd9aa4c
共有 1 個文件被更改,包括 9 次插入4 次删除
  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();
         }
     }
 }