// Update is called once per frame void FixedUpdate() { if (Input.GetMouseButtonDown(0)) { this.determine(); } Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit)) { if (hit.transform.name.Length > 5) { if (hit.transform.name.Substring(0, 5).Equals("blok(")) { // Debug.Log(hit.transform.name.Substring(0, 5)); if (StaticMethodLib.stringTOcoordinate(hit.transform.name).getX() == co.getX() && StaticMethodLib.stringTOcoordinate(hit.transform.name).getY() == co.getY()) { } else { for (int i = 0; i < 20; i++) { for (int j = 0; j < 20; j++) { if (!b[i, j].getFix()) { b[i, j].setShow(false); } } } co = StaticMethodLib.stringTOcoordinate(hit.transform.name); } } } } if (Input.GetMouseButtonDown(1)) { Ray ray2 = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit2; if (Physics.Raycast(ray2, out hit2)) { // Debug.Log(hit.transform.name); dis = Main.ResetDisplayWay(hit2.transform.name); // blokAbstract.setblokName(hit.transform.name); } } coordinate[] coo = new coordinate[5]; coo = findBlok(dis.getBlok(), dis.getSide(), dis.getAngle(), co); for (int i = 0; i < coo.Length; i++) { // Debug.Log(i + " is success"); int x = coo[i].getX() - 1; int y = coo[i].getY() - 1; // Debug.Log("$ "+x+" "+y); if (x >= 20 || x < 0) { } else if (y >= 20 || y < 0) { } else { b[x, y].setShow(true); } } }
void Start() { objName = gameObject.name; obj = GameObject.Find(objName); co = StaticMethodLib.stringTOcoordinate(objName); }