Browse Source

Missing file

Till Steinert 2 years ago
parent
commit
df1076348f
1 changed files with 32 additions and 0 deletions
  1. 32 0
      Assets/Scripts/Obstacles/SlalomPassed.cs

+ 32 - 0
Assets/Scripts/Obstacles/SlalomPassed.cs

@@ -0,0 +1,32 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public enum WaypointType { slalom1, slalom2, finish};
+public class SlalomPassed : MonoBehaviour
+{
+     public WaypointType type;
+    // Start is called before the first frame update
+    void Start()
+    {
+        
+    }
+
+    // Update is called once per frame
+    void Update()
+    {
+        
+    }
+
+    private void OnTriggerEnter(Collider other)
+    {
+            if (other.CompareTag("bike"))
+            {
+                // Set finished in statistics, so success is logged
+                var bikePlayer = GameObject.Find("bike");
+                var playerStats = bikePlayer.GetComponent<PlayerStats>();
+                Debug.Log("Waypoint passed");
+                playerStats.SetWaypointPassed(type);
+            }
+    }
+}