-
Notifications
You must be signed in to change notification settings - Fork 0
/
CarContactController.cs
24 lines (24 loc) · 1.15 KB
/
CarContactController.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CarContactController : MonoBehaviour {
ParticleController pc;
Collider col;
void Start () {
pc = transform.Find ("Particles").GetComponent<ParticleController> ();
col = GetComponent<Collider> ();
}
void OnTriggerEnter (Collider other) {
if (other.tag == "Coin") {
CollectCoinText.instance.CollectCoin (col.ClosestPoint (other.transform.position));
//print (transform.TransformPoint (col.ClosestPoint (other.transform.position)));
////print (col.ClosestPoint (other.transform.position));
// CollectCoinText.instance.CollectCoin (transform.InverseTransformPoint (col.ClosestPoint (other.transform.position)));
pc.PlayCoinHit (transform.InverseTransformPoint (col.ClosestPoint (other.transform.position)));
//pc.PlayOrbHit(transform.InverseTransformPoint(col.ClosestPoint(other.transform.position)));
}
if (other.tag == "Orb") {
pc.PlayOrbHit (transform.InverseTransformPoint (col.ClosestPoint (other.transform.position)));
}
}
}