public void OpenWindow(GameObject g) { if (world.objWindow != null) { world.objWindow.Close(); } //instantiate object GameObject go = Instantiate(g); go.transform.SetParent(GameObject.Find("OpenedMenus").transform); go.transform.SetAsFirstSibling(); go.name = "ObjWindow"; RectTransform rt = go.GetComponent <RectTransform>(); rt.localScale = new Vector3(1, 1, 1); //window vars ObjWindow objWindow = go.GetComponent <ObjWindow>(); objWindow.obj = this; objWindow.WorldController = world; world.objWindow = objWindow; //open window objWindow.Open(); }
// private void OnMouseOver() { //if (InputController.GetPositiveInputDown("ClickObject")) // Debug.Log("click"); //if (InputController.GetPositiveInputDown("ClickObject") && !WindowOpen) { // OpenWindow(); // } // } public void OpenWindow(GameObject g) { if (!openWindow) { return; } if (WindowOpen) { return; } //if (world.timeController.IsPaused) // return; if (world.mouse.actionController.currentAction != null) { return; } //if (world.objWindow != null) // world.objWindow.Close(); //instantiate object GameObject go = Instantiate(g); go.transform.SetParent(world.objectMenus.transform); go.transform.SetAsLastSibling(); go.name = "ObjWindow"; RectTransform rt = go.GetComponent <RectTransform>(); rt.localScale = new Vector3(1, 1, 1); //window vars ObjWindow objWindow = go.GetComponent <ObjWindow>(); objWindow.obj = this; objWindow.WorldController = world; //world.objWindow = objWindow; //open window objWindow.Open(); WindowOpen = true; }