More dialogue improvements, barks stop on dialogue now
This commit is contained in:
Binary file not shown.
@@ -905,6 +905,20 @@ MonoBehaviour:
|
||||
value:
|
||||
type: 0
|
||||
typeString: CustomFieldType_Text
|
||||
- id: 21
|
||||
fields:
|
||||
- title: Name
|
||||
value: CH02SpiderBossKilled
|
||||
type: 0
|
||||
typeString: CustomFieldType_Text
|
||||
- title: Initial Value
|
||||
value: False
|
||||
type: 2
|
||||
typeString: CustomFieldType_Boolean
|
||||
- title: Description
|
||||
value:
|
||||
type: 0
|
||||
typeString: CustomFieldType_Text
|
||||
conversations:
|
||||
- id: 1
|
||||
fields:
|
||||
@@ -24562,7 +24576,7 @@ MonoBehaviour:
|
||||
type: 0
|
||||
typeString: CustomFieldType_Text
|
||||
- title: Sequence
|
||||
value:
|
||||
value: AudioWait(Dialogues/TimeToEscape Beggar Dialogue/New_Story/On_Herbalist/Q3_Beggar_n_4)
|
||||
type: 0
|
||||
typeString: CustomFieldType_Text
|
||||
- title: pl
|
||||
@@ -24583,7 +24597,8 @@ MonoBehaviour:
|
||||
destinationDialogueID: 8
|
||||
isConnector: 0
|
||||
priority: 2
|
||||
conditionsString: Variable["CH02HerbalistSpoke"] == true
|
||||
conditionsString: Variable["CH02HerbalistSpoke"] == true and (Variable["CH02SpiderBossKilled"]
|
||||
== false)
|
||||
userScript:
|
||||
onExecute:
|
||||
m_PersistentCalls:
|
||||
@@ -24638,7 +24653,7 @@ MonoBehaviour:
|
||||
type: 0
|
||||
typeString: CustomFieldType_Text
|
||||
- title: Sequence
|
||||
value:
|
||||
value: AudioWait(Dialogues/TimeToEscape Beggar Dialogue/New_Story/On_Herbalist/Q3_Beggar_n_5)
|
||||
type: 0
|
||||
typeString: CustomFieldType_Text
|
||||
- title: pl
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3c84b775d4f6240b185527d49e09404f
|
||||
guid: bc7b4d42ce9b640aba413f92d69211b6
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
|
||||
@@ -905,6 +905,20 @@ MonoBehaviour:
|
||||
value:
|
||||
type: 0
|
||||
typeString: CustomFieldType_Text
|
||||
- id: 21
|
||||
fields:
|
||||
- title: Name
|
||||
value: CH02SpiderBossKilled
|
||||
type: 0
|
||||
typeString: CustomFieldType_Text
|
||||
- title: Initial Value
|
||||
value: False
|
||||
type: 2
|
||||
typeString: CustomFieldType_Boolean
|
||||
- title: Description
|
||||
value:
|
||||
type: 0
|
||||
typeString: CustomFieldType_Text
|
||||
conversations:
|
||||
- id: 1
|
||||
fields:
|
||||
@@ -24067,7 +24081,7 @@ MonoBehaviour:
|
||||
- title: Title
|
||||
value: START
|
||||
type: 0
|
||||
typeString:
|
||||
typeString: CustomFieldType_Text
|
||||
- title: Pictures
|
||||
value: '[]'
|
||||
type: 3
|
||||
@@ -24075,7 +24089,7 @@ MonoBehaviour:
|
||||
- title: Description
|
||||
value:
|
||||
type: 0
|
||||
typeString:
|
||||
typeString: CustomFieldType_Text
|
||||
- title: Actor
|
||||
value: 1
|
||||
type: 5
|
||||
@@ -24087,15 +24101,15 @@ MonoBehaviour:
|
||||
- title: Menu Text
|
||||
value:
|
||||
type: 0
|
||||
typeString:
|
||||
typeString: CustomFieldType_Text
|
||||
- title: Dialogue Text
|
||||
value:
|
||||
type: 0
|
||||
typeString:
|
||||
typeString: CustomFieldType_Text
|
||||
- title: Parenthetical
|
||||
value:
|
||||
type: 0
|
||||
typeString:
|
||||
typeString: CustomFieldType_Text
|
||||
- title: Audio Files
|
||||
value: '[]'
|
||||
type: 3
|
||||
@@ -24103,11 +24117,11 @@ MonoBehaviour:
|
||||
- title: Video File
|
||||
value:
|
||||
type: 0
|
||||
typeString:
|
||||
typeString: CustomFieldType_Text
|
||||
- title: Sequence
|
||||
value: None()
|
||||
type: 0
|
||||
typeString:
|
||||
typeString: CustomFieldType_Text
|
||||
- title: pl
|
||||
value:
|
||||
type: 4
|
||||
@@ -24132,6 +24146,12 @@ MonoBehaviour:
|
||||
destinationDialogueID: 10
|
||||
isConnector: 0
|
||||
priority: 2
|
||||
- originConversationID: 96
|
||||
originDialogueID: 0
|
||||
destinationConversationID: 96
|
||||
destinationDialogueID: 11
|
||||
isConnector: 0
|
||||
priority: 2
|
||||
conditionsString:
|
||||
userScript:
|
||||
onExecute:
|
||||
@@ -24562,7 +24582,7 @@ MonoBehaviour:
|
||||
type: 0
|
||||
typeString: CustomFieldType_Text
|
||||
- title: Sequence
|
||||
value:
|
||||
value: AudioWait(Dialogues/TimeToEscape Beggar Dialogue/New_Story/On_Herbalist/Q3_Beggar_n_4)
|
||||
type: 0
|
||||
typeString: CustomFieldType_Text
|
||||
- title: pl
|
||||
@@ -24583,7 +24603,8 @@ MonoBehaviour:
|
||||
destinationDialogueID: 8
|
||||
isConnector: 0
|
||||
priority: 2
|
||||
conditionsString: Variable["CH02HerbalistSpoke"] == true
|
||||
conditionsString: Variable["CH02HerbalistSpoke"] == true and (Variable["CH02SpiderBossKilled"]
|
||||
== false)
|
||||
userScript:
|
||||
onExecute:
|
||||
m_PersistentCalls:
|
||||
@@ -24638,7 +24659,7 @@ MonoBehaviour:
|
||||
type: 0
|
||||
typeString: CustomFieldType_Text
|
||||
- title: Sequence
|
||||
value:
|
||||
value: AudioWait(Dialogues/TimeToEscape Beggar Dialogue/New_Story/On_Herbalist/Q3_Beggar_n_5)
|
||||
type: 0
|
||||
typeString: CustomFieldType_Text
|
||||
- title: pl
|
||||
@@ -24713,7 +24734,7 @@ MonoBehaviour:
|
||||
type: 0
|
||||
typeString: CustomFieldType_Text
|
||||
- title: Sequence
|
||||
value:
|
||||
value: Audio(Dialogues/VO/CH02/Beggar/CH02_vo_herbalist_wanderer_03)
|
||||
type: 0
|
||||
typeString: CustomFieldType_Text
|
||||
- title: pl
|
||||
@@ -24815,6 +24836,152 @@ MonoBehaviour:
|
||||
y: 101
|
||||
width: 160
|
||||
height: 30
|
||||
- id: 11
|
||||
fields:
|
||||
- title: Title
|
||||
value:
|
||||
type: 0
|
||||
typeString: CustomFieldType_Text
|
||||
- title: Pictures
|
||||
value: '[]'
|
||||
type: 3
|
||||
typeString: CustomFieldType_Files
|
||||
- title: Description
|
||||
value:
|
||||
type: 0
|
||||
typeString: CustomFieldType_Text
|
||||
- title: Actor
|
||||
value: 2
|
||||
type: 5
|
||||
typeString: CustomFieldType_Actor
|
||||
- title: Conversant
|
||||
value: 1
|
||||
type: 5
|
||||
typeString: CustomFieldType_Actor
|
||||
- title: Menu Text
|
||||
value:
|
||||
type: 0
|
||||
typeString: CustomFieldType_Text
|
||||
- title: Dialogue Text
|
||||
value: The spider crone is dead... After all these years of terror... Alas,
|
||||
her brood survives, and soon another shall take her place.
|
||||
type: 0
|
||||
typeString: CustomFieldType_Text
|
||||
- title: Parenthetical
|
||||
value:
|
||||
type: 0
|
||||
typeString: CustomFieldType_Text
|
||||
- title: Audio Files
|
||||
value: '[]'
|
||||
type: 3
|
||||
typeString: CustomFieldType_Files
|
||||
- title: Video File
|
||||
value:
|
||||
type: 0
|
||||
typeString: CustomFieldType_Text
|
||||
- title: Sequence
|
||||
value: AudioWait(Dialogues/TimeToEscape Beggar Dialogue/New_Story/On_Spider_Boss/Q3_Beggar_n_6)
|
||||
type: 0
|
||||
typeString: CustomFieldType_Text
|
||||
- title: pl
|
||||
value:
|
||||
type: 4
|
||||
typeString: CustomFieldType_Localization
|
||||
conversationID: 96
|
||||
isRoot: 0
|
||||
isGroup: 0
|
||||
nodeColor:
|
||||
delaySimStatus: 0
|
||||
falseConditionAction: Block
|
||||
conditionPriority: 2
|
||||
outgoingLinks:
|
||||
- originConversationID: 96
|
||||
originDialogueID: 11
|
||||
destinationConversationID: 96
|
||||
destinationDialogueID: 12
|
||||
isConnector: 0
|
||||
priority: 2
|
||||
conditionsString: Variable["CH02SpiderBossKilled"] == true
|
||||
userScript:
|
||||
onExecute:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
canvasRect:
|
||||
serializedVersion: 2
|
||||
x: 478
|
||||
y: 71
|
||||
width: 160
|
||||
height: 30
|
||||
- id: 12
|
||||
fields:
|
||||
- title: Title
|
||||
value:
|
||||
type: 0
|
||||
typeString: CustomFieldType_Text
|
||||
- title: Pictures
|
||||
value: '[]'
|
||||
type: 3
|
||||
typeString: CustomFieldType_Files
|
||||
- title: Description
|
||||
value:
|
||||
type: 0
|
||||
typeString: CustomFieldType_Text
|
||||
- title: Actor
|
||||
value: 2
|
||||
type: 5
|
||||
typeString: CustomFieldType_Actor
|
||||
- title: Conversant
|
||||
value: 1
|
||||
type: 5
|
||||
typeString: CustomFieldType_Actor
|
||||
- title: Menu Text
|
||||
value:
|
||||
type: 0
|
||||
typeString: CustomFieldType_Text
|
||||
- title: Dialogue Text
|
||||
value: And her poison still defiles the river. Nothing ever changes. This
|
||||
land is beyond hope.
|
||||
type: 0
|
||||
typeString: CustomFieldType_Text
|
||||
- title: Parenthetical
|
||||
value:
|
||||
type: 0
|
||||
typeString: CustomFieldType_Text
|
||||
- title: Audio Files
|
||||
value: '[]'
|
||||
type: 3
|
||||
typeString: CustomFieldType_Files
|
||||
- title: Video File
|
||||
value:
|
||||
type: 0
|
||||
typeString: CustomFieldType_Text
|
||||
- title: Sequence
|
||||
value: AudioWait(Dialogues/TimeToEscape Beggar Dialogue/New_Story/On_Spider_Boss/Q3_Beggar_n_7)
|
||||
type: 0
|
||||
typeString: CustomFieldType_Text
|
||||
- title: pl
|
||||
value:
|
||||
type: 4
|
||||
typeString: CustomFieldType_Localization
|
||||
conversationID: 96
|
||||
isRoot: 0
|
||||
isGroup: 0
|
||||
nodeColor:
|
||||
delaySimStatus: 0
|
||||
falseConditionAction: Block
|
||||
conditionPriority: 2
|
||||
outgoingLinks: []
|
||||
conditionsString:
|
||||
userScript:
|
||||
onExecute:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
canvasRect:
|
||||
serializedVersion: 2
|
||||
x: 478
|
||||
y: 121
|
||||
width: 160
|
||||
height: 30
|
||||
canvasScrollPosition: {x: 0, y: 0}
|
||||
canvasZoom: 1
|
||||
- id: 97
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -30,6 +30,8 @@ namespace Beyond
|
||||
// This field is used by the custom editor for the Lua wizard.
|
||||
[HideInInspector]
|
||||
public DialogueDatabase selectedDatabase = null;
|
||||
[Tooltip("How often to check the condition (in seconds). If zero, only checks on start/load.")]
|
||||
public float CheckInterval = 1.0f;
|
||||
|
||||
private bool hasFired = false;
|
||||
|
||||
@@ -40,6 +42,8 @@ namespace Beyond
|
||||
{
|
||||
base.Start();
|
||||
CheckConditionAndExecute();
|
||||
if (CheckInterval > 0)
|
||||
InvokeRepeating("CheckConditionAndExecute", CheckInterval + (Random.value * CheckInterval), CheckInterval);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -70,6 +70,9 @@ namespace Beyond // Ensure this namespace matches your project structure
|
||||
|
||||
public bool IsPlaying => m_audioSource != null && m_audioSource.isPlaying;
|
||||
|
||||
// --- NEW: Flag to control bark playback ---
|
||||
private bool m_isPaused = false;
|
||||
|
||||
// --- Core Methods ---
|
||||
|
||||
public override void Awake()
|
||||
@@ -93,6 +96,29 @@ namespace Beyond // Ensure this namespace matches your project structure
|
||||
SetupAudioSource();
|
||||
InitializeSaveData();
|
||||
BuildConversationLookup();
|
||||
|
||||
}
|
||||
|
||||
// --- NEW: Subscribe to Dialogue System events ---
|
||||
private void OnEnable()
|
||||
{
|
||||
var dialogueSystemEvents = DialogueManager.instance.GetComponent<DialogueSystemEvents>();
|
||||
if (dialogueSystemEvents != null)
|
||||
{
|
||||
dialogueSystemEvents.conversationEvents.onConversationStart.AddListener(OnConversationStart);
|
||||
dialogueSystemEvents.conversationEvents.onConversationEnd.AddListener(OnConversationEnd);
|
||||
}
|
||||
}
|
||||
|
||||
// --- NEW: Unsubscribe from Dialogue System events ---
|
||||
private void OnDisable()
|
||||
{
|
||||
var dialogueSystemEvents = DialogueManager.instance.GetComponent<DialogueSystemEvents>();
|
||||
if (dialogueSystemEvents != null)
|
||||
{
|
||||
dialogueSystemEvents.conversationEvents.onConversationStart.RemoveListener(OnConversationStart);
|
||||
dialogueSystemEvents.conversationEvents.onConversationEnd.RemoveListener(OnConversationEnd);
|
||||
}
|
||||
}
|
||||
|
||||
private void SetupAudioSource()
|
||||
@@ -152,6 +178,9 @@ namespace Beyond // Ensure this namespace matches your project structure
|
||||
/// <returns>The AudioClip that will be played (or null if none/delayed).</returns>
|
||||
public AudioClip PlayBark(int entryIndex, Transform barkTarget = null, int specificBarkIndex = -1)
|
||||
{
|
||||
// --- MODIFIED: Check if barks are paused ---
|
||||
if (m_isPaused) return null;
|
||||
|
||||
if (entryIndex < 0 || entryIndex >= m_barks.Length)
|
||||
{
|
||||
Debug.LogError($"BarkManager: Invalid entryIndex {entryIndex}.", this);
|
||||
@@ -223,6 +252,9 @@ namespace Beyond // Ensure this namespace matches your project structure
|
||||
/// </summary>
|
||||
public void PlayBark(string conversation, Transform barkTarget = null)
|
||||
{
|
||||
// --- MODIFIED: Check if barks are paused ---
|
||||
if (m_isPaused) return;
|
||||
|
||||
if (m_conversationToEntry.TryGetValue(conversation, out int entryIndex))
|
||||
{
|
||||
// Determine target *before* queuing, store null if Player isn't available/needed
|
||||
@@ -248,6 +280,9 @@ namespace Beyond // Ensure this namespace matches your project structure
|
||||
/// </summary>
|
||||
public void PlayBarkFromQueue(int entryIndex, Transform barkTarget = null)
|
||||
{
|
||||
// --- MODIFIED: Check if barks are paused ---
|
||||
if (m_isPaused) return;
|
||||
|
||||
// Queue the original target (null if default intended). Update loop will resolve Player.Instance if needed.
|
||||
m_barkQueue.Enqueue(new QueuedBarkRequest { entryIndex = entryIndex, target = barkTarget });
|
||||
}
|
||||
@@ -267,6 +302,9 @@ namespace Beyond // Ensure this namespace matches your project structure
|
||||
/// </summary>
|
||||
private AudioClip PlayBarkImmediately(BarkEntry barkEntry, Transform targetForText, int specificBarkIndex = -1)
|
||||
{
|
||||
// --- MODIFIED: Check if barks are paused ---
|
||||
if (m_isPaused) return null;
|
||||
|
||||
if (barkEntry.barks == null || barkEntry.barks.Length == 0) return null;
|
||||
|
||||
Bark barkToPlay = null;
|
||||
@@ -361,6 +399,9 @@ namespace Beyond // Ensure this namespace matches your project structure
|
||||
|
||||
private void Update()
|
||||
{
|
||||
// --- MODIFIED: Check if barks are paused ---
|
||||
if (m_isPaused) return;
|
||||
|
||||
// Process the queue for externally triggered RANDOM barks
|
||||
if (m_barkQueue.Count > 0 && !IsPlaying)
|
||||
{
|
||||
@@ -382,5 +423,45 @@ namespace Beyond // Ensure this namespace matches your project structure
|
||||
PlayBark(request.entryIndex, targetForText, -1);
|
||||
}
|
||||
}
|
||||
|
||||
// --- NEW: Event handlers for conversation start and end ---
|
||||
private void OnConversationStart(Transform actor)
|
||||
{
|
||||
//PauseBarks();
|
||||
StopBarks();
|
||||
}
|
||||
|
||||
private void OnConversationEnd(Transform actor)
|
||||
{
|
||||
//ResumeBarks();
|
||||
}
|
||||
|
||||
// --- NEW: Public methods to pause and resume barks ---
|
||||
public void StopBarks()
|
||||
{
|
||||
if (m_audioSource != null && m_audioSource.isPlaying)
|
||||
{
|
||||
m_audioSource.Stop();
|
||||
}
|
||||
m_barkQueue.Clear(); // Clear any pending barks
|
||||
}
|
||||
public void PauseBarks()
|
||||
{
|
||||
m_isPaused = true;
|
||||
if (m_audioSource != null && m_audioSource.isPlaying)
|
||||
{
|
||||
m_audioSource.Pause();
|
||||
}
|
||||
m_barkQueue.Clear(); // Clear any pending barks
|
||||
}
|
||||
|
||||
public void ResumeBarks()
|
||||
{
|
||||
m_isPaused = false;
|
||||
if (m_audioSource != null)
|
||||
{
|
||||
m_audioSource.UnPause();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user