diff --git a/NewHorizons/Builder/Props/DialogueBuilder.cs b/NewHorizons/Builder/Props/DialogueBuilder.cs new file mode 100644 index 00000000..3acf3f8b --- /dev/null +++ b/NewHorizons/Builder/Props/DialogueBuilder.cs @@ -0,0 +1,38 @@ +using NewHorizons.External; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace NewHorizons.Builder.Props +{ + public static class DialogueBuilder + { + public static void Make(GameObject go, Sector sector, PropModule.DialogueInfo info) + { + GameObject conversationZone = new GameObject("ConversationZone"); + conversationZone.SetActive(false); + + conversationZone.layer = LayerMask.NameToLayer("Interactible"); + + var sphere = conversationZone.AddComponent(); + sphere.radius = info.radius; + sphere.isTrigger = true; + + conversationZone.AddComponent(); + + var dialogueTree = conversationZone.AddComponent(); + + // XML STUFF GOES HERE + + + + + conversationZone.transform.parent = sector.transform; + conversationZone.transform.localPosition = Vector3.zero; + conversationZone.SetActive(true); + } + } +} diff --git a/NewHorizons/Builder/Props/PropBuildManager.cs b/NewHorizons/Builder/Props/PropBuildManager.cs index cc8e26e7..e9c1ff66 100644 --- a/NewHorizons/Builder/Props/PropBuildManager.cs +++ b/NewHorizons/Builder/Props/PropBuildManager.cs @@ -32,6 +32,10 @@ namespace NewHorizons.Builder.Props GeyserBuilder.Make(go, sector, geyserInfo); } } + if(config.Props.Rafts != null) + { + // TODO + } if(config.Props.Tornados != null) { foreach(var tornadoInfo in config.Props.Tornados) @@ -39,6 +43,13 @@ namespace NewHorizons.Builder.Props TornadoBuilder.Make(go, sector, tornadoInfo, config.Atmosphere?.Cloud != null); } } + if(config.Props.Dialogue != null) + { + foreach(var dialogueInfo in config.Props.Dialogue) + { + DialogueBuilder.Make(go, sector, dialogueInfo); + } + } } public static GameObject LoadPrefab(string assetBundle, string path, string uniqueModName, IModAssets assets) diff --git a/NewHorizons/External/PropModule.cs b/NewHorizons/External/PropModule.cs index d58d9945..02385e41 100644 --- a/NewHorizons/External/PropModule.cs +++ b/NewHorizons/External/PropModule.cs @@ -14,6 +14,7 @@ namespace NewHorizons.External public RaftInfo[] Rafts; public GeyserInfo[] Geysers; public TornadoInfo[] Tornados; + public DialogueInfo[] Dialogue; public class ScatterInfo { @@ -57,5 +58,12 @@ namespace NewHorizons.External public float width; public MColor tint; } + + public class DialogueInfo + { + public MVector3 position; + public float radius; + public string xmlFile; + } } }