CoinUpdate.cs 741 B

12345678910111213141516171819202122232425262728
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using Pools;
  5. //Jede Kreuzung die eine Richtungsänderung der Route hervorruft braucht dieses Skript
  6. //(jedoch nicht die slalom referenzpunkte)
  7. public class CoinUpdate : MonoBehaviour
  8. {
  9. public CoinCreation coinCreator;
  10. // Start is called before the first frame update
  11. void Start()
  12. {
  13. coinCreator = GameObject.FindGameObjectWithTag("Route").GetComponent<CoinCreation>();
  14. }
  15. //Keep count of collisions with player
  16. private void OnTriggerEnter(Collider other)
  17. {
  18. if (other.gameObject.CompareTag("bike"))
  19. {
  20. Debug.Log("New Coins Coming!");
  21. coinCreator.PlaceCoins();
  22. }
  23. }
  24. }