public void OnDrop(PointerEventData eventData) { if (Input.GetMouseButtonUp(0)) { canCreate = false; Vector3 wordPos; Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; int layer_mask = LayerMask.GetMask("area_create"); if (Physics.Raycast(ray, out hit, 1000f, layer_mask)) { wordPos = hit.point; GameObject clone = Instantiate(gameobject, wordPos, Quaternion.identity); clone.tag = gameController.i_am_a; if (netconnection != null) { attack_info attack_Info_ = new attack_info(); attack_Info_.name = "Shower"; attack_Info_.tag = gameController.i_am_a; attack_Info_.room_name = gameController.room_name; attack_Info_.position = slashcheck(Round(wordPos.x, 4) + "," + Round(wordPos.y, 4) + "," + Round(wordPos.z, 4)); netconnection.attackReq(attack_Info_); } } } cameraHandler.enabled = true; area_create.SetActive(false); }
public void OnDrop(PointerEventData eventData) { if (Input.GetMouseButtonUp(0)) { canCreate = false; Vector3 wordPos; Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; int layer_mask = LayerMask.GetMask("area_create"); if (Physics.Raycast(ray, out hit, 1000f, layer_mask)) { Debug.Log("hit"); wordPos = hit.point; GameObject clone = Instantiate(gameobject, wordPos, Quaternion.identity); clone.tag = gameController.i_am_a; clone.name = character_name + "_" + gameController.i_am_a + "_" + Create_count; // clone.GetComponent<AgentInfo>().current_level = current_level; if (netconnection != null) { attack_info attack_Info_ = new attack_info(); attack_Info_.name = character_name; attack_Info_.object_name = clone.name; attack_Info_.tag = gameController.i_am_a; attack_Info_.room_name = gameController.room_name; attack_Info_.level = current_level; Debug.Log("send : " + wordPos.x + "," + wordPos.y + "," + wordPos.z); attack_Info_.position = wordPos.x.ToString("F4") + "," + wordPos.y.ToString("F4") + "," + wordPos.z.ToString("F4"); netconnection.attackReq(attack_Info_); } Create_count++; } } cameraHandler.enabled = true; area_create.SetActive(false); }