Game đua xe 3D
30.499 lượt xem;
1 using UnityEngine;
2 using System.Collections;
3
4 public class sendhitmes : MonoBehaviour {
5 Transform nextBrotherNode;
6 void OnTriggerEnter(Collider other) {
7 int index = transform.parent.GetSiblingIndex();
8 if (index < transform.parent.parent.childCount-1)
9 {
10 nextBrotherNode = transform.parent.parent.GetChild(index + 1);
11 }
12 else
13 {
14 nextBrotherNode = transform.parent.parent.GetChild(0);
15 }
16 other.gameObject.SendMessageUpwards("hitMark", nextBrotherNode);
17 }
18
19 }
2 using System.Collections;
3
4 public class sendhitmes : MonoBehaviour {
5 Transform nextBrotherNode;
6 void OnTriggerEnter(Collider other) {
7 int index = transform.parent.GetSiblingIndex();
8 if (index < transform.parent.parent.childCount-1)
9 {
10 nextBrotherNode = transform.parent.parent.GetChild(index + 1);
11 }
12 else
13 {
14 nextBrotherNode = transform.parent.parent.GetChild(0);
15 }
16 other.gameObject.SendMessageUpwards("hitMark", nextBrotherNode);
17 }
18
19 }