Skip to content

Commit 09d693a

Browse files
committed
Now DialogueBehaviour takes care of disabling UI dialogue when not paused
1 parent d3657f6 commit 09d693a

File tree

5 files changed

+40
-0
lines changed

5 files changed

+40
-0
lines changed

UOP1_Project/Assets/Scenes/Managers/Gameplay.unity

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,12 @@ PrefabInstance:
535535
propertyPath: _dialogueManager
536536
value:
537537
objectReference: {fileID: 670213351}
538+
- target: {fileID: 1395789391861871560, guid: acaae42dd59e9664faee318857afc823,
539+
type: 3}
540+
propertyPath: _onLineEndedEvent
541+
value:
542+
objectReference: {fileID: 11400000, guid: 8c589a71a937d334db35937f7b5bb25e,
543+
type: 2}
538544
- target: {fileID: 1395789391861871561, guid: acaae42dd59e9664faee318857afc823,
539545
type: 3}
540546
propertyPath: m_Name
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
%YAML 1.1
2+
%TAG !u! tag:unity3d.com,2011:
3+
--- !u!114 &11400000
4+
MonoBehaviour:
5+
m_ObjectHideFlags: 0
6+
m_CorrespondingSourceObject: {fileID: 0}
7+
m_PrefabInstance: {fileID: 0}
8+
m_PrefabAsset: {fileID: 0}
9+
m_GameObject: {fileID: 0}
10+
m_Enabled: 1
11+
m_EditorHideFlags: 0
12+
m_Script: {fileID: 11500000, guid: 7fafac715ff920c4383fed91a38a351e, type: 3}
13+
m_Name: LineEndedTimeline
14+
m_EditorClassIdentifier:
15+
description:

UOP1_Project/Assets/ScriptableObjects/Events/Cutscene/LineEndedTimeline.asset.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

UOP1_Project/Assets/Scripts/Cutscenes/CutsceneManager.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ public class CutsceneManager : MonoBehaviour
1919

2020
[SerializeField] public VoidEventChannelSO _pauseTimelineEvent = default;
2121

22+
[SerializeField] public VoidEventChannelSO _onLineEndedEvent = default;
23+
2224
private PlayableDirector _activePlayableDirector;
2325
private bool _isPaused;
2426

@@ -38,6 +40,7 @@ private void Start()
3840
_playCutsceneEvent.OnEventRaised += PlayCutscene;
3941
_playDialogueEvent.OnEventRaised += PlayDialogueFromClip;
4042
_pauseTimelineEvent.OnEventRaised += PauseTimeline;
43+
_onLineEndedEvent.OnEventRaised += LineEnded ;
4144

4245
}
4346
void PlayCutscene(PlayableDirector activePlayableDirector)

UOP1_Project/Assets/Scripts/Cutscenes/DialogueControlTrack/DialogueBehaviour.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public class DialogueBehaviour : PlayableBehaviour
1313

1414
[HideInInspector] public DialogueLineChannelSO PlayDialogueEvent;
1515
[HideInInspector] public VoidEventChannelSO PauseTimelineEvent;
16+
[SerializeField] public VoidEventChannelSO LineEndedEvent;
1617

1718
private bool _dialoguePlayed;
1819

@@ -54,10 +55,17 @@ public override void OnBehaviourPause(Playable playable, FrameData info)
5455
&& _dialoguePlayed)
5556
{
5657
if (_pauseWhenClipEnds)
58+
{
5759
if (PauseTimelineEvent != null)
5860
{
5961
PauseTimelineEvent.OnEventRaised();
6062
}
63+
}
64+
else
65+
{
66+
//We need to disable the dialogue UI when the line is finished
67+
LineEndedEvent.RaiseEvent();
68+
}
6169
}
6270
}
6371
}

0 commit comments

Comments
 (0)