void Shot() { Ray ray; RaycastHit hit; bool utsu = false; if (mode == 1) { ray = camera.ScreenPointToRay(center); } else { ray = camera.ScreenPointToRay(Input.mousePosition); } if (Input.GetMouseButtonDown(0) || Input.GetKeyDown(KeyCode.Return)) { sound[0].Play(); utsu = true; } if (Physics.Raycast(ray, out hit, distance)) { if (hit.transform.gameObject.tag == "Trigger") { GameObject obj = hit.transform.gameObject; TriggerScript tr = obj.GetComponent <TriggerScript> (); CScript.Check(tr.GetX(), tr.GetY()); if (utsu && canmove) { if (!manager.canPut(ScoreScript.TURNCOLOR, tr.GetX(), tr.GetY())) { Instantiate(bom, hit.point, Quaternion.identity); } manager.Putstone(ScoreScript.TURNCOLOR, tr.GetX(), tr.GetY()); GameObject se = Instantiate(hitsound, hit.point, Quaternion.identity) as GameObject; Destroy(se, 10); } } else { if (utsu) { GameObject se = Instantiate(hitsound, hit.point, Quaternion.identity) as GameObject; Destroy(se, 10); Instantiate(bom, hit.point, Quaternion.identity); } if (hit.transform.gameObject.tag == "Top") { if (utsu) { hit.transform.gameObject.SendMessage("Change"); } } else if (hit.transform.gameObject.tag == "BGMHit") { if (utsu) { BGM.SendMessage("BGMClick"); } } else { CScript.Check(-1, -1); } } } else { CScript.Check(-1, -1); } }