|
@@ -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();
|
|
|
}
|
|
|
}
|
|
|
}
|