private void Start() { GunReach = GameObject.FindWithTag("CompObject").GetComponent <GunReach>(); DestroyEffect2 = (GameObject)Resources.Load("DestroyEffect2"); playerRaycasting = GameObject.FindWithTag("Player").GetComponentInChildren <playerRaycasting> (); if (this.gameObject.name == "CompObject1(Clone)") { cube1 = transform.GetChild(1).GetComponent <CompCubeHit> (); } if (this.gameObject.name == "CompObject2(Clone)") { cube1 = transform.GetChild(1).GetComponent <CompCubeHit> (); cube2 = transform.GetChild(2).GetComponent <CompCubeHit> (); cube3 = transform.GetChild(3).GetComponent <CompCubeHit> (); } if (this.gameObject.name == "CompObject3(Clone)") { cube1 = transform.GetChild(1).GetComponent <CompCubeHit> (); cube2 = transform.GetChild(2).GetComponent <CompCubeHit> (); cube3 = transform.GetChild(3).GetComponent <CompCubeHit> (); cube4 = transform.GetChild(4).GetComponent <CompCubeHit> (); } if (this.gameObject.name == "CompObject4(Clone)") { cube1 = transform.GetChild(1).GetComponent <CompCubeHit>(); cube2 = transform.GetChild(2).GetComponent <CompCubeHit>(); cube3 = transform.GetChild(3).GetComponent <CompCubeHit>(); cube4 = transform.GetChild(4).GetComponent <CompCubeHit>(); } }
void Start() { GunReach = GameObject.FindWithTag("CompObject").GetComponent <GunReach> (); }