123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- using UnityEngine;
- using UnityEngine.AI;
- public class LocationController : MonoBehaviour
- {
- public List<GameObject> rooms;
- public GameObject Location;
-
- void Start()
- {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- var rooms_0 = Instantiate(Resources.Load("GameObjects/Cube", typeof(GameObject)) as GameObject);
- rooms_0.transform.SetParent(Location.transform);
- Cube(rooms_0, new Vector3(22.8f, 5.5f, 1));
- rooms.Add(rooms_0);
-
-
-
-
-
-
-
- }
-
- void Update()
- {
- }
- public static void Cube(GameObject cube, Vector3 cube_size, Vector2 position = new Vector2(), float wall_thickness = 0.01f)
- {
-
- cube_size = new Vector3(cube_size.x, cube_size.y, cube_size.z);
- Vector3 pos_cube = new Vector3(cube_size.x / 2f, cube_size.z / 2f, cube_size.y / 2f);
- cube.transform.position = new Vector3(pos_cube.x + position.x, pos_cube.y, pos_cube.z + position.y);
-
- GameObject plane_a = cube.transform.GetChild(0).gameObject;
-
- plane_a.transform.localScale = new Vector3(cube_size.x, wall_thickness, cube_size.y);
- plane_a.transform.localPosition = new Vector3(0, pos_cube.y, 0);
-
- GameObject plane_b = cube.transform.GetChild(1).gameObject;
- plane_b.transform.localScale = new Vector3(cube_size.x, wall_thickness, cube_size.z);
- plane_b.transform.localPosition = new Vector3(0, 0, -pos_cube.z);
-
- GameObject plane_c = cube.transform.GetChild(2).gameObject;
- plane_c.transform.localScale = new Vector3(cube_size.y, wall_thickness, cube_size.z);
- plane_c.transform.localPosition = new Vector3(-pos_cube.x, 0, 0);
-
- GameObject plane_d = cube.transform.GetChild(3).gameObject;
- plane_d.transform.localScale = new Vector3(cube_size.x, wall_thickness, cube_size.y);
- plane_d.transform.localPosition = new Vector3(0, -pos_cube.y, 0);
-
- GameObject plane_e = cube.transform.GetChild(4).gameObject;
- plane_e.transform.localScale = new Vector3(cube_size.y, wall_thickness, cube_size.z);
- plane_e.transform.localPosition = new Vector3(pos_cube.x, 0, 0);
-
- GameObject plane_f = cube.transform.GetChild(5).gameObject;
- plane_f.transform.localScale = new Vector3(cube_size.x, wall_thickness, cube_size.z);
- plane_f.transform.localPosition = new Vector3(0, 0, pos_cube.z);
- }
- public static void Room(string room_name, Vector3 cube_size, Vector2 position = new Vector2())
- {
-
- var room = Instantiate(Resources.Load("GameObjects/RoomTest", typeof(GameObject)) as GameObject);
- room.name = room_name;
- cube_size = new Vector3(cube_size.x, cube_size.y, cube_size.z);
- Vector3 pos_cube = new Vector3(cube_size.x / 2f, cube_size.z / 2f, cube_size.y / 2f);
- room.transform.position = new Vector3(pos_cube.x + position.x, pos_cube.y, pos_cube.z + position.y);
-
- var SideA = room.transform.GetChild(0).gameObject;
- var panel_a = Instantiate(Resources.Load("GameObjects/Panel", typeof(GameObject)) as GameObject);
- panel_a.name = "Plane_a_" + 0;
- panel_a.transform.SetParent(SideA.transform);
-
-
- panel_a.transform.localScale = new Vector3(cube_size.x, 0.01f, cube_size.y);
- panel_a.transform.localPosition = new Vector3(0, pos_cube.y, 0);
- panel_a.transform.rotation = SideA.transform.rotation;
-
- var SideB = room.transform.GetChild(1).gameObject;
-
-
- for (int i = 0; i < cube_size.x; i++)
- {
- var panel = Instantiate(Resources.Load("GameObjects/Panel", typeof(GameObject))) as GameObject;
- panel.name = "Plane_b_" + i;
- panel.transform.SetParent(SideB.transform);
- panel.transform.localPosition = new Vector3(i, 0, -pos_cube.z);
- panel.transform.rotation = SideB.transform.rotation;
- }
-
- var SideC = room.transform.GetChild(2).gameObject;
-
- for (int i = 0; i > -cube_size.x; i--)
- {
- var panel = Instantiate(Resources.Load("GameObjects/Panel", typeof(GameObject))) as GameObject;
- panel.name = "Plane_c_" + i;
- panel.transform.SetParent(SideC.transform);
- panel.transform.position = new Vector3(i, 0, 0);
- panel.transform.rotation = SideC.transform.rotation;
- }
-
- var SideD = room.transform.GetChild(3).gameObject;
- var panel_d = Instantiate(Resources.Load("GameObjects/Panel", typeof(GameObject))) as GameObject;
-
- panel_d.name = "Plane_d_" + 0;
- panel_d.transform.SetParent(SideD.transform);
- panel_d.transform.localScale = new Vector3(cube_size.x, 0.01f, cube_size.y);
- panel_d.transform.position = new Vector3(0, -pos_cube.y, 0);
- panel_d.transform.rotation = SideD.transform.rotation;
-
- var SideE = room.transform.GetChild(4).gameObject;
- for (int i = 0; i > -cube_size.x; i--)
- {
- var panel = Instantiate(Resources.Load("GameObjects/Panel", typeof(GameObject))) as GameObject;
-
- panel.name = "Plane_e_" + i;
- panel.transform.SetParent(SideE.transform);
- panel.transform.position = new Vector3(pos_cube.x, 0, 0);
- panel.transform.rotation = SideE.transform.rotation;
- }
-
- var SideF = room.transform.GetChild(5).gameObject;
- for (int i = 0; i > -cube_size.x; i--)
- {
- var panel = Instantiate(Resources.Load("GameObjects/Panel", typeof(GameObject))) as GameObject;
-
- panel.name = "Plane_f_" + i;
- panel.transform.SetParent(SideF.transform);
- panel.transform.position = new Vector3(0, 0, pos_cube.z);
- panel.transform.rotation = SideF.transform.rotation;
- }
- }
- }
|