SlalomPassed.cs 811 B

1234567891011121314151617181920212223242526272829303132
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public enum WaypointType { slalom1, slalom2, finish};
  5. public class SlalomPassed : MonoBehaviour
  6. {
  7. public WaypointType type;
  8. // Start is called before the first frame update
  9. void Start()
  10. {
  11. }
  12. // Update is called once per frame
  13. void Update()
  14. {
  15. }
  16. private void OnTriggerEnter(Collider other)
  17. {
  18. if (other.CompareTag("bike"))
  19. {
  20. // Set finished in statistics, so success is logged
  21. var bikePlayer = GameObject.Find("bike");
  22. var playerStats = bikePlayer.GetComponent<PlayerStats>();
  23. Debug.Log("Waypoint passed");
  24. playerStats.SetWaypointPassed(type);
  25. }
  26. }
  27. }