1234567891011121314151617181920212223242526272829303132 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class CoinCollider : MonoBehaviour
- {
- // Start is called before the first frame update
- void Start()
- {
-
- }
- // Update is called once per frame
- void Update()
- {
-
- }
-
- void OnCollisionEnter(Collision collision) {
- Debug.Log("Hit Coin");
- }
- void OnTriggerEnter(Collider collision) {
- Debug.Log("Hit Coin");
- var kind = collision.gameObject;
- // Only consider collision if it's with player
- //if (kind.tag == "bike") {
- kind.GetComponent<PlayerStats>().hitCounter += 1;
- Destroy(gameObject); // Destroy Coin
- //}
- }
- }
|