void Awake() { if (C_hologram_Part == null || C_hologram_Part.tag == "Pivot") { Debug.Log("From Puzzle_Hologram_repository 홀로그램 파트 적용 안됐음! pivot 오브젝트 말고 홀로그램 본체여야 함." + this.gameObject); } Hologram_Puzzle_Controller = C_hologram_Part.transform.parent.parent.gameObject; script_Puzzle_Hologram = Hologram_Puzzle_Controller.GetComponent <Puzzle_Hologram>(); moduleObj = GetComponent <Obj_Module_Operation>().child_Module[0]; if (C_hologram_Part.GetComponent <Puzzle_Part_Hologram>() != null) { C_hologram_Part.GetComponent <Puzzle_Part_Hologram>().module_Linked = moduleObj; } else { Debug.Log("From Puzzle_Hologram_repository 오브젝트 설정 제대로 안됨. 홀로그램 본체(피봇아님)을 집어 넣을 것 : " + this.gameObject); } for (int i = 0; i < transform.childCount; i++) { if (transform.GetChild(i).tag == "Pivot") { pivot_Obj = transform.GetChild(i); //피봇 오브젝트 참조 } } StartCoroutine(Wait_And_Awake()); }
void Awake() { //if (GetComponent<BoxCollider>() != null) GetComponent<BoxCollider>().isTrigger = true; //박스 콜리더 여러개인 특이케이스 있다. 주의할 것 //if (GetComponent<SphereCollider>() != null) GetComponent<SphereCollider>().isTrigger = true; //if (GetComponent<CapsuleCollider>() != null) GetComponent<CapsuleCollider>().isTrigger = true; hologram_Joint = new GameObject[transform.childCount]; for (int i = 0; i < transform.childCount; i++) { if (transform.GetChild(i).tag == "Pivot") { hologram_Joint[i] = transform.GetChild(i).gameObject; } } Base_Puzzle_Obj = transform.parent.parent.gameObject; if (Base_Puzzle_Obj.GetComponent <Puzzle_Hologram>() == null) { Debug.Log("From Puzzle_Part_Hologram 베이스 오브젝트 설정 잘 안됌. 자식 부모 관계 확인 ㄱ " + this.gameObject); } else { script_PH = Base_Puzzle_Obj.GetComponent <Puzzle_Hologram>(); } Related_assemble_Section = Base_Puzzle_Obj.GetComponent <Puzzle_Hologram>().puzzle_Section_pivot; Connected_Hologram = new GameObject[transform.childCount]; if (GetComponent <BoxCollider>() == null && GetComponent <SphereCollider>() == null && GetComponent <CapsuleCollider>() == null) { Debug.Log("From Puzzle_Part_Hologram 오브젝트에 콜리더 적용 안됐음! " + this.gameObject); } original_Scale = transform.localScale; }
void Awake() { if (Connected_GameObj.GetComponent <Puzzle_Hologram>() != null) { script_P = Connected_GameObj.GetComponent <Puzzle_Hologram>(); } if (Connected_GameObj.GetComponent <Puzzle_Hologram_2>() != null) { script_P2 = Connected_GameObj.GetComponent <Puzzle_Hologram_2>(); } if (script_P == null && script_P2 == null) { Debug.Log("From Door_2 변수 오류 " + this.gameObject); } StartCoroutine(Cyclic_Check()); }
} //인식기 각도 변경 void Get_target_hologram_Info() { RaycastHit hit; Ray ray = new Ray(cam_Head.transform.position, cam_Head.transform.forward); if (Physics.Raycast(ray, out hit, cam_Check_Distance)) { if (hit.transform.GetComponent <Puzzle_Part_Hologram>() != null) { script_PH = hit.transform.GetComponent <Puzzle_Part_Hologram>().script_PH; script_PH2 = null; } else if (hit.transform.GetComponent <Puzzle_Hologram_2>() != null) { script_PH2 = hit.transform.GetComponent <Puzzle_Hologram_2>(); script_PH = null; } else { script_PH = null; script_PH2 = null; } } else { script_PH = null; script_PH2 = null; } //Debug.Log("From function_CNN get signal Check : " + cam_Head + " " + cam_Check_Angle + " " + cam_Check_Distance); int i = 0; Collider[] overlapped_Obj = Physics.OverlapSphere(transform.position, cam_Check_Distance); // 나중에 여기에 레이어 마스크 먹이자 foreach (Collider node in overlapped_Obj) { if (node.GetComponent <Puzzle_Node>() != null) { if (node.GetComponent <Puzzle_Node>().Get_Signal(cam_Head, cam_Check_Angle, cam_Check_Distance)) { node_in_Distance[i++] = node.gameObject; //Debug.Log("From function_CNN nodeCheck True node"); } //else Debug.Log("From function_CNN nodeCheck false node"); } } } //일정 거리 &각도 안에 노드에게 인식 정보 전달 및 노드 정보 받음
public void GetSignal(Vector3 contact_Point, GameObject target_Obj) { //Debug.Log("From function_CNN Get Signal"); contact_point_Received = contact_Point; if (target_Obj.GetComponent <Puzzle_Part_Hologram>() != null) { script_PH = target_Obj.GetComponent <Puzzle_Part_Hologram>().script_PH; script_PH2 = null; } else if (target_Obj.GetComponent <Puzzle_Hologram_2>() != null) { script_PH2 = target_Obj.GetComponent <Puzzle_Hologram_2>(); script_PH = null; } cam_head_position = cam_Head.transform.position; Quaternion_cam_will_Look = Quaternion.LookRotation((contact_Point - cam_head_position).normalized); Cam_Look(); //Debug.Log("From function_CNN Get Cam head position : " + cam_head_position); //Debug.Log("From function_CNN Get Cam head global position : " + transform.TransformPoint(cam_head_position)); } // 플레이어의 전기탄이 홀로그램에 부딪혀서 그 정보가 이곳으로
void Reset() { hologram_Joint = new GameObject[transform.childCount]; for (int i = 0; i < transform.childCount; i++) { if (transform.GetChild(i).tag == "Pivot") { hologram_Joint[i] = transform.GetChild(i).gameObject; } } Base_Puzzle_Obj = transform.parent.parent.gameObject; if (Base_Puzzle_Obj.GetComponent <Puzzle_Hologram>() == null) { Debug.Log("From Puzzle_Part_Hologram 베이스 오브젝트 설정 잘 안됌. 자식 부모 관계 확인 ㄱ " + this.gameObject); } else { script_PH = Base_Puzzle_Obj.GetComponent <Puzzle_Hologram>(); } Related_assemble_Section = Base_Puzzle_Obj.GetComponent <Puzzle_Hologram>().puzzle_Section_pivot; original_Scale = transform.localScale; }
} //일정 거리 &각도 안에 노드에게 인식 정보 전달 및 노드 정보 받음 IEnumerator Cyclic_Result_Check() { while (true) { //Debug.Log("From function_CNN Corouting Running" + this.gameObject ); yield return(new WaitForSeconds(1.0f)); if (script_T.Circuit_On) { Get_target_hologram_Info(); //주기적으로 노드에게 인식 정보 전달 } else { script_PH = null; script_PH2 = null; } int i = 0, j; if (script_PH != null) { for (j = 0; j < 4; j++) { if (script_PH.Node_Check_result[j]) { if (!script_PH.Node_Check_Cleared[j]) { Send_order_to_Hologram(i++); script_PH.Node_Check_Cleared[j] = true; } GetComponent <Line_Connection>().ScriptOnOff(true); } } } else if (script_PH2 != null) { for (j = 0; j < 4; j++) { if (script_PH2.Node_Check_result[j]) { if (!script_PH2.Node_Check_Cleared[j]) { Send_order_to_Hologram(i++); script_PH2.Node_Check_Cleared[j] = true; } GetComponent <Line_Connection>().ScriptOnOff(true); } } } /*if (script_PH != null) foreach (bool result in script_PH.Node_Check_result) { * if (result) Send_order_to_Hologram(i); * i++; * } * else if(script_PH2 != null) foreach (bool result in script_PH2.Node_Check_result) * { * if (result) Send_order_to_Hologram(i); * i++; * }*/ else { GetComponent <Line_Connection>().ScriptOnOff(false); } //Debug.Log("From function_CNN coroutine Check"); } } // 주기적으로 노드 인식 정보 전달 및 체크