using System; using System.Collections; using System.Collections.Generic; using System.Linq; using UnityEngine; using UnityEngine.UI; public class WallsController : MonoBehaviour { //public Button ButtonWall; //public Button ButtonRoom; //public Button ButtonDel; public GameObject Cursor; public int Rounding = 1; public List Walls = new List(); enum Tools { Wall, Room, Del, Cursor}; Tools tools = Tools.Cursor; private Vector3 screenPoint; private Vector3 offset; private Vector3 curScreenPoint; private Vector3 curPosition; bool new_well = false; // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { } public void WallCreate() { tools = Tools.Wall; Cursor.SetActive(true); var last = Walls.LastOrDefault(); if(last != null)last.GetComponent().BoxColliderEnabled = false; } public void RoomCreate() { tools = Tools.Room; var Cube = Instantiate(Resources.Load("GameObjects/Cube", typeof(GameObject))) as GameObject; Cube.AddComponent(); Cube.transform.position = new Vector3(0.5f, 0.5f, 0.5f); new_well = true; Walls.Add(Cube); Cursor.SetActive(false); } public void Delete() { tools = Tools.Del; } void Editor() { switch (tools) { case Tools.Room: var Cube = Instantiate(Resources.Load("GameObjects/Cube", typeof(GameObject))) as GameObject; Cube.AddComponent(); Walls.Add(Cube); break; } } //void OnMouseDown() //{ // //Debug.Log(StagesEditorController.indexCursor); // switch (tools) // { // case Tools.Room: // screenPoint = Camera.main.WorldToScreenPoint(gameObject.transform.position); // offset = gameObject.transform.position - Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPoint.z)); // break; // } //} // Перемещение }