using System.Collections; using System.Collections.Generic; using UnityEngine; using System.Linq; using JetBrains.Annotations; using Pools; //Jeder Coin besitzt dieses Skript public class CoinCollection : MonoBehaviour { private CoinPool coinPool; // Start is called before the first frame update void Start() { coinPool = GameObject.FindGameObjectWithTag("CoinPool").GetComponent(); } //Keep count of collisions with player private void OnTriggerEnter(Collider other) { Debug.Log("Coin Hit!"); if (other.gameObject.CompareTag("bike")) { // Increase Hit Counter var bike = other.gameObject; bike.GetComponent().IncreaseCoinCounter(); //Returning Coin to Pool coinPool.ReturnToPool(gameObject); } } }