1234567891011121314151617181920212223242526272829303132 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class ObstacleCollision : MonoBehaviour
- {
- // Start is called before the first frame update
- void Start()
- {
-
- }
- // Update is called once per frame
- void Update()
- {
-
- }
- //Keep count of collisions with player
- private void OnTriggerEnter(Collider other)
- {
- Debug.Log("Detected Obstacle Collision!");
- if (other.gameObject.CompareTag("bike"))
- {
- Debug.Log("Detected Bike Collision!");
- // Increase Hit Counter
- var bike = other.gameObject;
- Debug.Log(bike.name);
- bike.GetComponent<PlayerStats>().IncreaseCollisionCounter();
- }
- }
- }
|