// Update is called once per frame void Update() { if (Input.GetMouseButtonDown(0) && sel == true) { if (nCam.GetObj() == nMain.currObj) { GameObject temp = Instantiate(TJpref, new Vector3(Camera.main.ScreenToWorldPoint(Input.mousePosition).x, Camera.main.ScreenToWorldPoint(Input.mousePosition).y, 0), new Quaternion(0, 0, 0, 0)); temp.name = "TargetJoint__" + nMain.currObj.name; temp.transform.parent = nMain.currObj.transform; } sel = false; } GameObject m = nCam.GetObj(); if (Input.GetMouseButtonDown(0) && m != null && (m.tag == "Rect" || m.tag == "Circle")) { nCurs.Current_Tex = nCurs.SelectCursore_act; nMain.currObj = m; if (nMain.currObj != null) { sel = true; } else { sel = false; } } if (Input.GetMouseButtonUp(0) && sel == false) { nCurs.Current_Tex = nCurs.SelectCursore_nact; } }
// Update is called once per frame void Update() { if (Input.GetMouseButton(0)) { nB_GUI.Cursor_tex = nB_GUI.DelCursore_act; GameObject i = nCam.GetObj(); if (i != null && (i.tag == "Wall" || i.tag == "Water")) { Destroy(i); } } if (Input.GetMouseButtonUp(0)) { nB_GUI.Cursor_tex = nB_GUI.DelCursore_nact; } }
// Update is called once per frame void Update() { if (Input.GetMouseButtonDown(0) && nMain.looseUI == true) { nCurs.Current_Tex = nCurs.SelectCursore_act; nMain.currObj = nCam.GetObj(); if (nMain.currObj != null) { Select_Settings(nMain.currObj.tag); } else { Select_Settings("0"); } } if (Input.GetMouseButtonUp(0)) { nCurs.Current_Tex = nCurs.SelectCursore_nact; } }
// Update is called once per frame void Update() { if (Input.GetMouseButton(0)) { nCurs.Current_Tex = nCurs.DelCursore_act; GameObject i = nCam.GetObj(); if (i != null && (i.tag == "Rect" || i.tag == "WatPart" || i.tag == "Circle")) { Destroy(i); } /*if (i != null && (i.tag == "WatPart")) * { * i.gameObject.SetActive(false); * }*/ } if (Input.GetMouseButtonUp(0)) { nCurs.Current_Tex = nCurs.DelCursore_nact; } }
// Update is called once per frame void Update() { if (Input.GetMouseButtonDown(0)) { curr = nCam.GetObj(); if (curr != null) { mp = Camera.main.ScreenToWorldPoint(Input.mousePosition) - curr.transform.position; } } if (Input.GetMouseButton(0)) { nCurs.Current_Tex = nCurs.DragCursore_act; if (curr != null && (curr.tag == "Rect" || curr.tag == "Circle")) { if (!nMain.pause) { Rigidbody2D irigid = curr.GetComponent <Rigidbody2D>(); irigid.gravityScale = 0; irigid.velocity = Vector2.zero; irigid.MovePosition(Camera.main.ScreenToWorldPoint(Input.mousePosition) - mp); } else { curr.transform.position = Camera.main.ScreenToWorldPoint(Input.mousePosition) - mp; Rigidbody2D irigid = curr.GetComponent <Rigidbody2D>(); irigid.velocity = Vector2.zero; } } } if (Input.GetMouseButtonUp(0)) { if (curr != null && (curr.tag == "Rect" || curr.tag == "Circle")) { nCurs.Current_Tex = nCurs.DragCursore_nact; curr.GetComponent <Rigidbody2D>().gravityScale = 1; curr = null; } } }
// Update is called once per frame void Update() { GameObject m = nCam.GetObj(); if (Input.GetMouseButtonDown(0) && m != null && (m.tag == "Rect" || m.tag == "Circle")) { if (state == 0) { nCurs.Current_Tex = nCurs.SelectCursore_act; nMain.currObj = m; state = 1; } else if (state == 1) { if (m == nMain.currObj) { nCurs.Current_Tex = nCurs.DelCursore_act;; Obj0 = m; V0 = Camera.main.ScreenToWorldPoint(Input.mousePosition); state = 2; } else { state = 0; } } else if (state == 2) { if (m != Obj0) { nCurs.Current_Tex = nCurs.SelectCursore_act;; nMain.currObj = m; state = 3; } else { state = 0; } } else if (state == 3) { if (m == nMain.currObj) { Obj1 = m; V1 = Camera.main.ScreenToWorldPoint(Input.mousePosition); GameObject temp = Instantiate(DJpref, new Vector3(0, 0, 0), new Quaternion(0, 0, 0, 0)); temp.name = "DistanceJoint__" + Obj0.name + "-" + Obj1.name; DJoint tcomp = temp.GetComponent <DJoint>(); tcomp.Obj0 = Obj0; tcomp.Obj1 = Obj1; tcomp.V0 = V0; tcomp.V1 = V1; } else { state = 0; } } } if (Input.GetMouseButtonUp(0) && state == 0) { Obj0 = null; V0 = Vector2.zero; Obj1 = null; V1 = Vector2.zero; nCurs.Current_Tex = nCurs.SelectCursore_nact; } }