123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- 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<GameObject> Walls = new List<GameObject>();
-
- 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<Room>().BoxColliderEnabled = false;
- }
- public void RoomCreate()
- {
- tools = Tools.Room;
- var Cube = Instantiate(Resources.Load("GameObjects/Cube", typeof(GameObject))) as GameObject;
- Cube.AddComponent<Room>();
- 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<Room>();
- 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;
- // }
- //}
- // Перемещение
- }
|