CoinUpdate.cs 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using Pools;
  5. using Study;
  6. //Jede Kreuzung die eine Richtungsänderung der Route hervorruft braucht dieses Skript (jedoch nicht die Slalomreferenzpunkte)
  7. public class CoinUpdate : MonoBehaviour
  8. {
  9. public int routeId = 9;
  10. private CoinCreation coinCreator;
  11. //public ConditionManager cm;
  12. // Start is called before the first frame update
  13. void Start()
  14. {
  15. coinCreator = GameObject.FindGameObjectWithTag("Route").GetComponent<CoinCreation>();
  16. }
  17. //Keep count of collisions with player
  18. private void OnTriggerEnter(Collider other)
  19. {
  20. if (other.gameObject.CompareTag("bike"))
  21. {
  22. var cm = GameObject.Find("ExperimentManager").GetComponent<ConditionManager>();
  23. int routeNbr = cm.GetRouteNumber();
  24. if (routeId == routeNbr) //only use skript for the route it belongs to
  25. {
  26. coinCreator.PlaceCoins();
  27. }
  28. }
  29. }
  30. }