|
@@ -24,10 +24,16 @@ public class EditorController : MonoBehaviour
|
|
|
|
|
|
public List<Beacon> Beacons = new List<Beacon>();
|
|
|
|
|
|
+ PlayerController player;
|
|
|
+ ModeController mode;
|
|
|
+ ToolsController tools;
|
|
|
+
|
|
|
|
|
|
void Start()
|
|
|
{
|
|
|
-
|
|
|
+ player = GameObject.Find("Canvas").transform.GetChild(2).GetComponent<PlayerController>();
|
|
|
+ mode = GameObject.Find("ButtonMode").GetComponent<ModeController>();
|
|
|
+ tools = GameObject.Find("EditorTools").GetComponent<ToolsController>();
|
|
|
}
|
|
|
|
|
|
|
|
@@ -66,12 +72,25 @@ public class EditorController : MonoBehaviour
|
|
|
|
|
|
public void Save()
|
|
|
{
|
|
|
- SceneManager.LoadScene("Location");
|
|
|
+
|
|
|
+ tools.CursorOff();
|
|
|
+ mode.Switch();
|
|
|
+ var l = new Location { id = PlayerController.locations.Count, name = Name.text };
|
|
|
+ PlayerController.locations.Add(l);
|
|
|
+ player.DropdownLocation.options.Add(new Dropdown.OptionData(l.name));
|
|
|
+ var locations = GameObject.Find("Locations").gameObject;
|
|
|
+ var location = new GameObject();
|
|
|
+ location.name = l.name;
|
|
|
+ location.transform.SetParent(locations.transform);
|
|
|
+ foreach (var w in WallCreate.Walls)
|
|
|
+ w.transform.SetParent(location.transform);
|
|
|
+ player.maps.Add(location);
|
|
|
}
|
|
|
|
|
|
public void Back()
|
|
|
{
|
|
|
- SceneManager.LoadScene("Location");
|
|
|
+
|
|
|
+ mode.Switch();
|
|
|
}
|
|
|
|
|
|
public void AddBeacon()
|