mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Added RemoteDialogueTrigger to dialogue config info
This commit is contained in:
parent
20a4d6e82b
commit
8bac10ddc6
@ -13,6 +13,42 @@ namespace NewHorizons.Builder.Props
|
|||||||
public static class DialogueBuilder
|
public static class DialogueBuilder
|
||||||
{
|
{
|
||||||
public static void Make(GameObject go, Sector sector, PropModule.DialogueInfo info)
|
public static void Make(GameObject go, Sector sector, PropModule.DialogueInfo info)
|
||||||
|
{
|
||||||
|
var dialogue = MakeConversationZone(go, sector, info);
|
||||||
|
if (info.remoteVolumePosition != null) MakeRemoteDialogueTrigger(go, sector, info, dialogue);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void MakeRemoteDialogueTrigger(GameObject go, Sector sector, PropModule.DialogueInfo info, CharacterDialogueTree dialogue)
|
||||||
|
{
|
||||||
|
GameObject conversationTrigger = new GameObject("ConversationTrigger");
|
||||||
|
conversationTrigger.SetActive(false);
|
||||||
|
|
||||||
|
var remoteDialogueTrigger = conversationTrigger.AddComponent<RemoteDialogueTrigger>();
|
||||||
|
var boxCollider = conversationTrigger.AddComponent<BoxCollider>();
|
||||||
|
conversationTrigger.AddComponent<OWCollider>();
|
||||||
|
|
||||||
|
remoteDialogueTrigger._listDialogues = new RemoteDialogueTrigger.RemoteDialogueCondition[]
|
||||||
|
{
|
||||||
|
new RemoteDialogueTrigger.RemoteDialogueCondition()
|
||||||
|
{
|
||||||
|
priority = 1,
|
||||||
|
dialogue = dialogue,
|
||||||
|
prereqConditionType = RemoteDialogueTrigger.MultiConditionType.AND,
|
||||||
|
prereqConditions = new string[]{ },
|
||||||
|
onTriggerEnterConditions = new string[]{ }
|
||||||
|
}
|
||||||
|
};
|
||||||
|
remoteDialogueTrigger._activatedDialogues = new bool[1];
|
||||||
|
remoteDialogueTrigger._deactivateTriggerPostConversation = true;
|
||||||
|
|
||||||
|
boxCollider.size = Vector3.one * info.radius / 2f;
|
||||||
|
|
||||||
|
conversationTrigger.transform.parent = sector?.transform ?? go.transform;
|
||||||
|
conversationTrigger.transform.localPosition = info.remoteVolumePosition;
|
||||||
|
conversationTrigger.SetActive(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static CharacterDialogueTree MakeConversationZone(GameObject go, Sector sector, PropModule.DialogueInfo info)
|
||||||
{
|
{
|
||||||
GameObject conversationZone = new GameObject("ConversationZone");
|
GameObject conversationZone = new GameObject("ConversationZone");
|
||||||
conversationZone.SetActive(false);
|
conversationZone.SetActive(false);
|
||||||
@ -34,10 +70,11 @@ namespace NewHorizons.Builder.Props
|
|||||||
dialogueTree.SetTextXml(text);
|
dialogueTree.SetTextXml(text);
|
||||||
AddTranslation(xml);
|
AddTranslation(xml);
|
||||||
|
|
||||||
|
conversationZone.transform.parent = sector?.transform ?? go.transform;
|
||||||
conversationZone.transform.parent = sector.transform;
|
|
||||||
conversationZone.transform.localPosition = info.position;
|
conversationZone.transform.localPosition = info.position;
|
||||||
conversationZone.SetActive(true);
|
conversationZone.SetActive(true);
|
||||||
|
|
||||||
|
return dialogueTree;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void AddTranslation(string xml)
|
private static void AddTranslation(string xml)
|
||||||
|
|||||||
2
NewHorizons/External/PropModule.cs
vendored
2
NewHorizons/External/PropModule.cs
vendored
@ -64,6 +64,8 @@ namespace NewHorizons.External
|
|||||||
public MVector3 position;
|
public MVector3 position;
|
||||||
public float radius;
|
public float radius;
|
||||||
public string xmlFile;
|
public string xmlFile;
|
||||||
|
public MVector3 remoteVolumePosition;
|
||||||
|
public string persistentCondition;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user