浏览代码
Working dialogue and cutscene system. (#135)
Working dialogue and cutscene system. (#135)
* Add Dialogue Track base implementation * Custom timeline track and clip for dialog - Can at any time call for a line of dialogue. - Each clip binds line of dialogue to be later displayed on screen. - Depending on the options of this clip, the Timeline might pause. * Made adjustments based on HyagoOliveiran's suggestions Tried to add more variables to increase legibility. Added UpdateSlide function. Deleted some empty lines. * Update Character.cs * Update Character.cs * Update Character.cs * Update Character.cs * Update Character.cs * Update Character.cs * Update UOP1_Project/Assets/Scripts/Characters/Character.cs I deleted unnecessary spacing by following atb-brown suggestion. Co-authored-by: Austin Brown <atb.austin@gmail.com> * Deleted unnecessary spacing * Fixed bouncing issue when player hit under floating platform * My take on a simple Player Spawn System * Renamed SetRequestS.../main
GitHub
4 年前
当前提交
ffe1b8b8
共有 71 个文件被更改,包括 4699 次插入 和 197 次删除
-
2UOP1_Project/Assets/Materials/Obstacles_Blue.mat
-
2UOP1_Project/Assets/Prefabs/GameplayEssentials/CameraSystem.prefab
-
2UOP1_Project/Assets/Scripts/CameraManager.cs
-
986UOP1_Project/Assets/Scripts/Input/GameInput.cs
-
4UOP1_Project/Assets/Scripts/Input/InputReader.cs
-
593UOP1_Project/Assets/Settings/Input/GameInput.inputactions
-
38.editorconfig
-
8UOP1_Project/Assets/Cutscenes.meta
-
8UOP1_Project/Assets/Scenes/Examples.meta
-
8UOP1_Project/Assets/ScriptableObjects/Narrative.meta
-
8UOP1_Project/Assets/Scripts/Cutscenes.meta
-
8UOP1_Project/Assets/Scripts/Dialogues.meta
-
1001UOP1_Project/Assets/Scripts/Editor/ReorderableList.cs
-
11UOP1_Project/Assets/Scripts/Editor/ReorderableList.cs.meta
-
483UOP1_Project/Assets/Cutscenes/ExampleCutscene.playable
-
8UOP1_Project/Assets/Cutscenes/ExampleCutscene.playable.meta
-
1001UOP1_Project/Assets/Scenes/Examples/CutsceneExample.unity
-
7UOP1_Project/Assets/Scenes/Examples/CutsceneExample.unity.meta
-
8UOP1_Project/Assets/ScriptableObjects/Narrative/Actors.meta
-
15UOP1_Project/Assets/ScriptableObjects/Narrative/Actors/BardHare.asset
-
8UOP1_Project/Assets/ScriptableObjects/Narrative/Actors/BardHare.asset.meta
-
15UOP1_Project/Assets/ScriptableObjects/Narrative/Actors/Hamlet.asset
-
8UOP1_Project/Assets/ScriptableObjects/Narrative/Actors/Hamlet.asset.meta
-
16UOP1_Project/Assets/ScriptableObjects/Narrative/Actors/Townsfolk.asset
-
8UOP1_Project/Assets/ScriptableObjects/Narrative/Actors/Townsfolk.asset.meta
-
8UOP1_Project/Assets/ScriptableObjects/Narrative/DialogueData.meta
-
8UOP1_Project/Assets/ScriptableObjects/Narrative/DialogueData/1.IntroToTown.meta
-
17UOP1_Project/Assets/ScriptableObjects/Narrative/DialogueData/1.IntroToTown/IntroDialogue.asset
-
8UOP1_Project/Assets/ScriptableObjects/Narrative/DialogueData/1.IntroToTown/IntroDialogue.asset.meta
-
8UOP1_Project/Assets/ScriptableObjects/Narrative/DialogueData/1.IntroToTown/Lines.meta
-
17UOP1_Project/Assets/ScriptableObjects/Narrative/DialogueData/1.IntroToTown/Lines/HeadToCentre.asset
-
8UOP1_Project/Assets/ScriptableObjects/Narrative/DialogueData/1.IntroToTown/Lines/HeadToCentre.asset.meta
-
16UOP1_Project/Assets/ScriptableObjects/Narrative/DialogueData/1.IntroToTown/Lines/Welcome.asset
-
8UOP1_Project/Assets/ScriptableObjects/Narrative/DialogueData/1.IntroToTown/Lines/Welcome.asset.meta
-
16UOP1_Project/Assets/ScriptableObjects/Narrative/DialogueData/GenericOink.asset
-
8UOP1_Project/Assets/ScriptableObjects/Narrative/DialogueData/GenericOink.asset.meta
-
81UOP1_Project/Assets/Scripts/Cutscenes/CutsceneManager.cs
-
3UOP1_Project/Assets/Scripts/Cutscenes/CutsceneManager.cs.meta
-
28UOP1_Project/Assets/Scripts/Cutscenes/CutsceneTrigger.cs
-
11UOP1_Project/Assets/Scripts/Cutscenes/CutsceneTrigger.cs.meta
-
8UOP1_Project/Assets/Scripts/Cutscenes/DialogueControlTrack.meta
-
54UOP1_Project/Assets/Scripts/Cutscenes/DialogueControlTrack/DialogueBehaviour.cs
-
11UOP1_Project/Assets/Scripts/Cutscenes/DialogueControlTrack/DialogueBehaviour.cs.meta
-
23UOP1_Project/Assets/Scripts/Cutscenes/DialogueControlTrack/DialogueClip.cs
-
11UOP1_Project/Assets/Scripts/Cutscenes/DialogueControlTrack/DialogueClip.cs.meta
-
9UOP1_Project/Assets/Scripts/Cutscenes/DialogueControlTrack/DialogueMixerBehaviour.cs
-
11UOP1_Project/Assets/Scripts/Cutscenes/DialogueControlTrack/DialogueMixerBehaviour.cs.meta
-
21UOP1_Project/Assets/Scripts/Cutscenes/DialogueControlTrack/DialogueTrack.cs
-
11UOP1_Project/Assets/Scripts/Cutscenes/DialogueControlTrack/DialogueTrack.cs.meta
-
13UOP1_Project/Assets/Scripts/Dialogues/ActorSO.cs
-
11UOP1_Project/Assets/Scripts/Dialogues/ActorSO.cs.meta
-
17UOP1_Project/Assets/Scripts/Dialogues/DialogueDataSO.cs
-
11UOP1_Project/Assets/Scripts/Dialogues/DialogueDataSO.cs.meta
-
16UOP1_Project/Assets/Scripts/Dialogues/DialogueLineSO.cs
-
11UOP1_Project/Assets/Scripts/Dialogues/DialogueLineSO.cs.meta
-
34UOP1_Project/Assets/Scripts/Dialogues/DialogueManager.cs
-
11UOP1_Project/Assets/Scripts/Dialogues/DialogueManager.cs.meta
-
8UOP1_Project/Assets/Scripts/Dialogues/Editor.meta
-
93UOP1_Project/Assets/Scripts/Dialogues/Editor/DialogueDataEditor.cs
-
11UOP1_Project/Assets/Scripts/Dialogues/Editor/DialogueDataEditor.cs.meta
986
UOP1_Project/Assets/Scripts/Input/GameInput.cs
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
[*.cs] |
|||
indent_style = tab |
|||
indent_size = tab |
|||
indent_with_tabs = 2 |
|||
align_with_tabs = true |
|||
align_keep_tabs = true |
|||
insert_final_newline = true |
|||
trim_trailing_whitespace = true |
|||
csharp_new_line_before_open_brace = all |
|||
csharp_new_line_before_else = true |
|||
csharp_new_line_before_catch = true |
|||
csharp_new_line_before_finally = true |
|||
csharp_new_line_between_query_expression_clauses = true |
|||
csharp_indent_case_contents = true |
|||
csharp_indent_switch_labels = true |
|||
csharp_indent_case_contents_when_block = false |
|||
csharp_space_around_binary_operators = before_and_after |
|||
csharp_space_between_method_declaration_parameter_list_parentheses = false |
|||
csharp_space_after_cast = false |
|||
csharp_space_after_keywords_in_control_flow_statements = true |
|||
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false |
|||
csharp_space_between_method_declaration_name_and_open_parenthesis = false |
|||
csharp_space_between_method_call_parameter_list_parentheses = false |
|||
csharp_space_between_method_call_empty_parameter_list_parentheses = false |
|||
csharp_space_between_method_call_name_and_opening_parenthesis = false |
|||
csharp_space_after_comma = true |
|||
csharp_space_before_comma = false |
|||
csharp_space_after_dot = false |
|||
csharp_space_before_dot = false |
|||
csharp_space_after_semicolon_in_for_statement = true |
|||
csharp_space_before_semicolon_in_for_statement = false |
|||
csharp_space_around_declaration_statements = false |
|||
csharp_space_before_open_square_brackets = false |
|||
csharp_space_between_empty_square_brackets = false |
|||
csharp_space_between_square_brackets = false |
|||
csharp_preserve_single_line_statements = false |
|||
csharp_preserve_single_line_blocks = true |
|||
csharp_using_directive_placement = outside_namespace |
|
|||
fileFormatVersion: 2 |
|||
guid: 435f65342da7bfd428389fcb009f7df9 |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 3b1d60b53a6707c4bbaafe50bb7669d9 |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: f3dfc6bd09db0bc48a552f2fac5946ea |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 85e2eb572e7825c408f15321e8d2ca07 |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 0920261e0cbaa394c96b2946f705cf08 |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
1001
UOP1_Project/Assets/Scripts/Editor/ReorderableList.cs
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
fileFormatVersion: 2 |
|||
guid: 827564c910b88e745a763d1776eb2e6d |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!114 &-9073006965474109427 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 1 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 12176dee71327c74498b489e9029a0ee, type: 3} |
|||
m_Name: DialogueControlClip(Clone) |
|||
m_EditorClassIdentifier: |
|||
_template: |
|||
_dialogueLine: {fileID: 11400000, guid: fda69b0faa3f28b4a87ba294f83eedea, type: 2} |
|||
_pauseWhenClipEnds: 1 |
|||
cutsceneManager: {fileID: 0} |
|||
cutsceneManager: {fileID: 0} |
|||
--- !u!114 &-8992890383746913626 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 1 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 90fb794a295e73545af71bcdb7375791, type: 3} |
|||
m_Name: CinemachineShot(Clone)(Clone) |
|||
m_EditorClassIdentifier: |
|||
DisplayName: |
|||
VirtualCamera: |
|||
exposedName: 1c8f1b80d9e25a64abea9e2d67cea3f3 |
|||
defaultValue: {fileID: 0} |
|||
--- !u!114 &-7243414920591819180 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 1 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 05acc715f855ced458d76ee6f8ac6c61, type: 3} |
|||
m_Name: Cinemachine Track |
|||
m_EditorClassIdentifier: |
|||
m_Version: 3 |
|||
m_AnimClip: {fileID: 0} |
|||
m_Locked: 0 |
|||
m_Muted: 0 |
|||
m_CustomPlayableFullTypename: |
|||
m_Curves: {fileID: 0} |
|||
m_Parent: {fileID: 11400000} |
|||
m_Children: [] |
|||
m_Clips: |
|||
- m_Version: 1 |
|||
m_Start: 0 |
|||
m_ClipIn: 0 |
|||
m_Asset: {fileID: 9211983919050520405} |
|||
m_Duration: 1.1 |
|||
m_TimeScale: 1 |
|||
m_ParentTrack: {fileID: -7243414920591819180} |
|||
m_EaseInDuration: 0 |
|||
m_EaseOutDuration: 0 |
|||
m_BlendInDuration: -1 |
|||
m_BlendOutDuration: 0.7333333333333334 |
|||
m_MixInCurve: |
|||
serializedVersion: 2 |
|||
m_Curve: |
|||
- serializedVersion: 3 |
|||
time: 0 |
|||
value: 0 |
|||
inSlope: 0 |
|||
outSlope: 0 |
|||
tangentMode: 0 |
|||
weightedMode: 0 |
|||
inWeight: 0 |
|||
outWeight: 0 |
|||
- serializedVersion: 3 |
|||
time: 1 |
|||
value: 1 |
|||
inSlope: 0 |
|||
outSlope: 0 |
|||
tangentMode: 0 |
|||
weightedMode: 0 |
|||
inWeight: 0 |
|||
outWeight: 0 |
|||
m_PreInfinity: 2 |
|||
m_PostInfinity: 2 |
|||
m_RotationOrder: 4 |
|||
m_MixOutCurve: |
|||
serializedVersion: 2 |
|||
m_Curve: |
|||
- serializedVersion: 3 |
|||
time: 0 |
|||
value: 1 |
|||
inSlope: 0 |
|||
outSlope: 0 |
|||
tangentMode: 0 |
|||
weightedMode: 0 |
|||
inWeight: 0 |
|||
outWeight: 0 |
|||
- serializedVersion: 3 |
|||
time: 1 |
|||
value: 0 |
|||
inSlope: 0 |
|||
outSlope: 0 |
|||
tangentMode: 0 |
|||
weightedMode: 0 |
|||
inWeight: 0 |
|||
outWeight: 0 |
|||
m_PreInfinity: 2 |
|||
m_PostInfinity: 2 |
|||
m_RotationOrder: 4 |
|||
m_BlendInCurveMode: 0 |
|||
m_BlendOutCurveMode: 0 |
|||
m_ExposedParameterNames: [] |
|||
m_AnimationCurves: {fileID: 0} |
|||
m_Recordable: 0 |
|||
m_PostExtrapolationMode: 0 |
|||
m_PreExtrapolationMode: 0 |
|||
m_PostExtrapolationTime: 0 |
|||
m_PreExtrapolationTime: 0 |
|||
m_DisplayName: CM vcam1 |
|||
- m_Version: 1 |
|||
m_Start: 0.36666666666666664 |
|||
m_ClipIn: 0 |
|||
m_Asset: {fileID: -7104271872717664822} |
|||
m_Duration: 3.433333333333333 |
|||
m_TimeScale: 1 |
|||
m_ParentTrack: {fileID: -7243414920591819180} |
|||
m_EaseInDuration: 0 |
|||
m_EaseOutDuration: 0 |
|||
m_BlendInDuration: 0.7333333333333334 |
|||
m_BlendOutDuration: 0.5333333333333332 |
|||
m_MixInCurve: |
|||
serializedVersion: 2 |
|||
m_Curve: |
|||
- serializedVersion: 3 |
|||
time: 0 |
|||
value: 0 |
|||
inSlope: 0 |
|||
outSlope: 0 |
|||
tangentMode: 0 |
|||
weightedMode: 0 |
|||
inWeight: 0 |
|||
outWeight: 0 |
|||
- serializedVersion: 3 |
|||
time: 1 |
|||
value: 1 |
|||
inSlope: 0 |
|||
outSlope: 0 |
|||
tangentMode: 0 |
|||
weightedMode: 0 |
|||
inWeight: 0 |
|||
outWeight: 0 |
|||
m_PreInfinity: 2 |
|||
m_PostInfinity: 2 |
|||
m_RotationOrder: 4 |
|||
m_MixOutCurve: |
|||
serializedVersion: 2 |
|||
m_Curve: |
|||
- serializedVersion: 3 |
|||
time: 0 |
|||
value: 1 |
|||
inSlope: 0 |
|||
outSlope: 0 |
|||
tangentMode: 0 |
|||
weightedMode: 0 |
|||
inWeight: 0 |
|||
outWeight: 0 |
|||
- serializedVersion: 3 |
|||
time: 1 |
|||
value: 0 |
|||
inSlope: 0 |
|||
outSlope: 0 |
|||
tangentMode: 0 |
|||
weightedMode: 0 |
|||
inWeight: 0 |
|||
outWeight: 0 |
|||
m_PreInfinity: 2 |
|||
m_PostInfinity: 2 |
|||
m_RotationOrder: 4 |
|||
m_BlendInCurveMode: 0 |
|||
m_BlendOutCurveMode: 0 |
|||
m_ExposedParameterNames: [] |
|||
m_AnimationCurves: {fileID: 0} |
|||
m_Recordable: 0 |
|||
m_PostExtrapolationMode: 0 |
|||
m_PreExtrapolationMode: 0 |
|||
m_PostExtrapolationTime: 0 |
|||
m_PreExtrapolationTime: 0 |
|||
m_DisplayName: CM vcam1 (1) |
|||
- m_Version: 1 |
|||
m_Start: 3.2666666666666666 |
|||
m_ClipIn: 0 |
|||
m_Asset: {fileID: -8992890383746913626} |
|||
m_Duration: 1.8000000000000003 |
|||
m_TimeScale: 1 |
|||
m_ParentTrack: {fileID: -7243414920591819180} |
|||
m_EaseInDuration: 0 |
|||
m_EaseOutDuration: 0 |
|||
m_BlendInDuration: 0.5333333333333332 |
|||
m_BlendOutDuration: -1 |
|||
m_MixInCurve: |
|||
serializedVersion: 2 |
|||
m_Curve: [] |
|||
m_PreInfinity: 2 |
|||
m_PostInfinity: 2 |
|||
m_RotationOrder: 4 |
|||
m_MixOutCurve: |
|||
serializedVersion: 2 |
|||
m_Curve: [] |
|||
m_PreInfinity: 2 |
|||
m_PostInfinity: 2 |
|||
m_RotationOrder: 4 |
|||
m_BlendInCurveMode: 0 |
|||
m_BlendOutCurveMode: 0 |
|||
m_ExposedParameterNames: [] |
|||
m_AnimationCurves: {fileID: 0} |
|||
m_Recordable: 0 |
|||
m_PostExtrapolationMode: 0 |
|||
m_PreExtrapolationMode: 0 |
|||
m_PostExtrapolationTime: 0 |
|||
m_PreExtrapolationTime: 0 |
|||
m_DisplayName: CM vcam1 |
|||
m_Markers: |
|||
m_Objects: [] |
|||
--- !u!114 &-7104271872717664822 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 1 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 90fb794a295e73545af71bcdb7375791, type: 3} |
|||
m_Name: CinemachineShot |
|||
m_EditorClassIdentifier: |
|||
DisplayName: |
|||
VirtualCamera: |
|||
exposedName: 9c910a5264e9c2a4493346b21c86a486 |
|||
defaultValue: {fileID: 0} |
|||
--- !u!114 &11400000 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: bfda56da833e2384a9677cd3c976a436, type: 3} |
|||
m_Name: ExampleCutscene |
|||
m_EditorClassIdentifier: |
|||
m_Version: 0 |
|||
m_Tracks: |
|||
- {fileID: -7243414920591819180} |
|||
- {fileID: 1900134804166205457} |
|||
m_FixedDuration: 0 |
|||
m_EditorSettings: |
|||
m_Framerate: 60 |
|||
m_DurationMode: 0 |
|||
m_MarkerTrack: {fileID: 5472072730035891554} |
|||
--- !u!114 &1900134804166205457 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 1 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 88bc95ff4e1f12c43a4672c8a05feaf4, type: 3} |
|||
m_Name: Dialogue Control Track |
|||
m_EditorClassIdentifier: |
|||
m_Version: 3 |
|||
m_AnimClip: {fileID: 0} |
|||
m_Locked: 0 |
|||
m_Muted: 0 |
|||
m_CustomPlayableFullTypename: |
|||
m_Curves: {fileID: 0} |
|||
m_Parent: {fileID: 11400000} |
|||
m_Children: [] |
|||
m_Clips: |
|||
- m_Version: 1 |
|||
m_Start: 0 |
|||
m_ClipIn: 0 |
|||
m_Asset: {fileID: 4587721134825755193} |
|||
m_Duration: 2.6666666666666656 |
|||
m_TimeScale: 1 |
|||
m_ParentTrack: {fileID: 1900134804166205457} |
|||
m_EaseInDuration: 0 |
|||
m_EaseOutDuration: 0 |
|||
m_BlendInDuration: 0 |
|||
m_BlendOutDuration: 0 |
|||
m_MixInCurve: |
|||
serializedVersion: 2 |
|||
m_Curve: |
|||
- serializedVersion: 3 |
|||
time: 0 |
|||
value: 0 |
|||
inSlope: 0 |
|||
outSlope: 0 |
|||
tangentMode: 0 |
|||
weightedMode: 0 |
|||
inWeight: 0 |
|||
outWeight: 0 |
|||
- serializedVersion: 3 |
|||
time: 1 |
|||
value: 1 |
|||
inSlope: 0 |
|||
outSlope: 0 |
|||
tangentMode: 0 |
|||
weightedMode: 0 |
|||
inWeight: 0 |
|||
outWeight: 0 |
|||
m_PreInfinity: 2 |
|||
m_PostInfinity: 2 |
|||
m_RotationOrder: 4 |
|||
m_MixOutCurve: |
|||
serializedVersion: 2 |
|||
m_Curve: |
|||
- serializedVersion: 3 |
|||
time: 0 |
|||
value: 1 |
|||
inSlope: 0 |
|||
outSlope: 0 |
|||
tangentMode: 0 |
|||
weightedMode: 0 |
|||
inWeight: 0 |
|||
outWeight: 0 |
|||
- serializedVersion: 3 |
|||
time: 1 |
|||
value: 0 |
|||
inSlope: 0 |
|||
outSlope: 0 |
|||
tangentMode: 0 |
|||
weightedMode: 0 |
|||
inWeight: 0 |
|||
outWeight: 0 |
|||
m_PreInfinity: 2 |
|||
m_PostInfinity: 2 |
|||
m_RotationOrder: 4 |
|||
m_BlendInCurveMode: 0 |
|||
m_BlendOutCurveMode: 0 |
|||
m_ExposedParameterNames: [] |
|||
m_AnimationCurves: {fileID: 0} |
|||
m_Recordable: 0 |
|||
m_PostExtrapolationMode: 0 |
|||
m_PreExtrapolationMode: 0 |
|||
m_PostExtrapolationTime: 0 |
|||
m_PreExtrapolationTime: 0 |
|||
m_DisplayName: FirstLine |
|||
- m_Version: 1 |
|||
m_Start: 4.2333333333333325 |
|||
m_ClipIn: 0 |
|||
m_Asset: {fileID: -9073006965474109427} |
|||
m_Duration: 0.8333333333333339 |
|||
m_TimeScale: 1 |
|||
m_ParentTrack: {fileID: 1900134804166205457} |
|||
m_EaseInDuration: 0 |
|||
m_EaseOutDuration: 0 |
|||
m_BlendInDuration: 0 |
|||
m_BlendOutDuration: 0 |
|||
m_MixInCurve: |
|||
serializedVersion: 2 |
|||
m_Curve: |
|||
- serializedVersion: 3 |
|||
time: 0 |
|||
value: 0 |
|||
inSlope: 0 |
|||
outSlope: 0 |
|||
tangentMode: 0 |
|||
weightedMode: 0 |
|||
inWeight: 0 |
|||
outWeight: 0 |
|||
- serializedVersion: 3 |
|||
time: 1 |
|||
value: 1 |
|||
inSlope: 0 |
|||
outSlope: 0 |
|||
tangentMode: 0 |
|||
weightedMode: 0 |
|||
inWeight: 0 |
|||
outWeight: 0 |
|||
m_PreInfinity: 2 |
|||
m_PostInfinity: 2 |
|||
m_RotationOrder: 4 |
|||
m_MixOutCurve: |
|||
serializedVersion: 2 |
|||
m_Curve: |
|||
- serializedVersion: 3 |
|||
time: 0 |
|||
value: 1 |
|||
inSlope: 0 |
|||
outSlope: 0 |
|||
tangentMode: 0 |
|||
weightedMode: 0 |
|||
inWeight: 0 |
|||
outWeight: 0 |
|||
- serializedVersion: 3 |
|||
time: 1 |
|||
value: 0 |
|||
inSlope: 0 |
|||
outSlope: 0 |
|||
tangentMode: 0 |
|||
weightedMode: 0 |
|||
inWeight: 0 |
|||
outWeight: 0 |
|||
m_PreInfinity: 2 |
|||
m_PostInfinity: 2 |
|||
m_RotationOrder: 4 |
|||
m_BlendInCurveMode: 0 |
|||
m_BlendOutCurveMode: 0 |
|||
m_ExposedParameterNames: [] |
|||
m_AnimationCurves: {fileID: 0} |
|||
m_Recordable: 0 |
|||
m_PostExtrapolationMode: 0 |
|||
m_PreExtrapolationMode: 0 |
|||
m_PostExtrapolationTime: 0 |
|||
m_PreExtrapolationTime: 0 |
|||
m_DisplayName: SecondLine |
|||
m_Markers: |
|||
m_Objects: [] |
|||
--- !u!114 &4587721134825755193 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 1 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 12176dee71327c74498b489e9029a0ee, type: 3} |
|||
m_Name: DialogueControlClip |
|||
m_EditorClassIdentifier: |
|||
_template: |
|||
_dialogueLine: {fileID: 11400000, guid: 9542270160df90441b23f4575fecee78, type: 2} |
|||
_pauseWhenClipEnds: 1 |
|||
cutsceneManager: {fileID: 0} |
|||
cutsceneManager: {fileID: 0} |
|||
--- !u!114 &5472072730035891554 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 1 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 2a16748d9461eae46a725db9776d5390, type: 3} |
|||
m_Name: Markers |
|||
m_EditorClassIdentifier: |
|||
m_Version: 3 |
|||
m_AnimClip: {fileID: 0} |
|||
m_Locked: 0 |
|||
m_Muted: 0 |
|||
m_CustomPlayableFullTypename: |
|||
m_Curves: {fileID: 0} |
|||
m_Parent: {fileID: 11400000} |
|||
m_Children: [] |
|||
m_Clips: [] |
|||
m_Markers: |
|||
m_Objects: [] |
|||
--- !u!114 &9211983919050520405 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 1 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 90fb794a295e73545af71bcdb7375791, type: 3} |
|||
m_Name: CinemachineShot |
|||
m_EditorClassIdentifier: |
|||
DisplayName: |
|||
VirtualCamera: |
|||
exposedName: 67a8876312de87a438022d114b2278b7 |
|||
defaultValue: {fileID: 0} |
|
|||
fileFormatVersion: 2 |
|||
guid: eaecfe91517330c48a870c5eb292a50b |
|||
NativeFormatImporter: |
|||
externalObjects: {} |
|||
mainObjectFileID: 0 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
1001
UOP1_Project/Assets/Scenes/Examples/CutsceneExample.unity
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
fileFormatVersion: 2 |
|||
guid: 54b0379f81d0e8b479ad9405fe862f25 |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 1170ad1c2e7cde04a85a72a6ab60745e |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!114 &11400000 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: f991c0f5eb9677944ae00c1b61548e72, type: 3} |
|||
m_Name: BardHare |
|||
m_EditorClassIdentifier: |
|||
_actorName: Bard Hare |
|
|||
fileFormatVersion: 2 |
|||
guid: 027d026cf519df04eb8b7bf251472e13 |
|||
NativeFormatImporter: |
|||
externalObjects: {} |
|||
mainObjectFileID: 0 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!114 &11400000 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: f991c0f5eb9677944ae00c1b61548e72, type: 3} |
|||
m_Name: Hamlet |
|||
m_EditorClassIdentifier: |
|||
_actorName: Hamlet |
|
|||
fileFormatVersion: 2 |
|||
guid: c7902af5c8e25244f94914ce51e7ea8a |
|||
NativeFormatImporter: |
|||
externalObjects: {} |
|||
mainObjectFileID: 0 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!114 &11400000 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: f991c0f5eb9677944ae00c1b61548e72, type: 3} |
|||
m_Name: Townsfolk |
|||
m_EditorClassIdentifier: |
|||
_actorName: Townsfolk |
|||
_face: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0} |
|
|||
fileFormatVersion: 2 |
|||
guid: 5e7bd0eed8324794fad1bc460c565ecb |
|||
NativeFormatImporter: |
|||
externalObjects: {} |
|||
mainObjectFileID: 0 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: c0e678346af101a4e8aaa8975027c511 |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 43a9e9ead37345b4b8f6028006c5f7eb |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!114 &11400000 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: a0c0171b565b4074a9462307824be26c, type: 3} |
|||
m_Name: IntroDialogue |
|||
m_EditorClassIdentifier: |
|||
dialogueLines: |
|||
- {fileID: 11400000, guid: 9542270160df90441b23f4575fecee78, type: 2} |
|||
- {fileID: 11400000, guid: fda69b0faa3f28b4a87ba294f83eedea, type: 2} |
|
|||
fileFormatVersion: 2 |
|||
guid: 77c8b5d4404526645a0cfc5acd5c9111 |
|||
NativeFormatImporter: |
|||
externalObjects: {} |
|||
mainObjectFileID: 0 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: ac060da2f1642384fa38afa581531acb |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!114 &11400000 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: e49a73eb0802e10429213abfb59e46e1, type: 3} |
|||
m_Name: HeadToCentre |
|||
m_EditorClassIdentifier: |
|||
_actor: {fileID: 11400000, guid: 5e7bd0eed8324794fad1bc460c565ecb, type: 2} |
|||
_sentence: Now head to the town centre, where the legendary chef is waiting for |
|||
you. |
|
|||
fileFormatVersion: 2 |
|||
guid: fda69b0faa3f28b4a87ba294f83eedea |
|||
NativeFormatImporter: |
|||
externalObjects: {} |
|||
mainObjectFileID: 0 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!114 &11400000 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: e49a73eb0802e10429213abfb59e46e1, type: 3} |
|||
m_Name: Welcome |
|||
m_EditorClassIdentifier: |
|||
_actor: {fileID: 11400000, guid: 5e7bd0eed8324794fad1bc460c565ecb, type: 2} |
|||
_sentence: Welcome to town! |
|
|||
fileFormatVersion: 2 |
|||
guid: 9542270160df90441b23f4575fecee78 |
|||
NativeFormatImporter: |
|||
externalObjects: {} |
|||
mainObjectFileID: 0 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!114 &11400000 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: e49a73eb0802e10429213abfb59e46e1, type: 3} |
|||
m_Name: GenericOink |
|||
m_EditorClassIdentifier: |
|||
_actor: {fileID: 11400000, guid: c7902af5c8e25244f94914ce51e7ea8a, type: 2} |
|||
_sentence: Oink oink! |
|
|||
fileFormatVersion: 2 |
|||
guid: 5395413ddd481544f996375600e6a33f |
|||
NativeFormatImporter: |
|||
externalObjects: {} |
|||
mainObjectFileID: 0 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using UnityEngine; |
|||
using UnityEngine.Playables; |
|||
|
|||
public class CutsceneManager : MonoBehaviour |
|||
{ |
|||
|
|||
[SerializeField] private InputReader _inputReader = default; |
|||
[SerializeField] private DialogueManager _dialogueManager = default; |
|||
|
|||
private PlayableDirector _activePlayableDirector; |
|||
private bool _isPaused; |
|||
|
|||
public bool IsCutscenePlaying => _activePlayableDirector.playableGraph.GetRootPlayable(0).GetSpeed() != 0d; |
|||
|
|||
private void OnEnable() |
|||
{ |
|||
_inputReader.gameInput.Dialogues.AdvanceDialogue.performed += ctx => OnAdvance(); |
|||
} |
|||
|
|||
private void OnDisable() |
|||
{ |
|||
_inputReader.gameInput.Dialogues.AdvanceDialogue.performed -= ctx => OnAdvance(); |
|||
} |
|||
|
|||
public void PlayCutscene(PlayableDirector activePlayableDirector) |
|||
{ |
|||
_activePlayableDirector = activePlayableDirector; |
|||
|
|||
_isPaused = false; |
|||
_activePlayableDirector.Play(); |
|||
_activePlayableDirector.stopped += ctx => CutsceneEnded(); |
|||
|
|||
EnableDialogueInput(); |
|||
} |
|||
|
|||
public void CutsceneEnded() |
|||
{ |
|||
EnableGameplayInput(); |
|||
} |
|||
|
|||
public void PlayDialogueFromClip(DialogueLineSO dialogueLine) |
|||
{ |
|||
_dialogueManager.DisplayDialogueLine(dialogueLine); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// This callback is executed when the player presses the button to advance dialogues. If the Timeline is currently paused due to a <c>DialogueControlClip</c>, it will resume its playback.
|
|||
/// </summary>
|
|||
private void OnAdvance() |
|||
{ |
|||
if (_isPaused) |
|||
ResumeTimeline(); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Called by <c>DialogueControlClip</c> on the Timeline.
|
|||
/// </summary>
|
|||
public void PauseTimeline() |
|||
{ |
|||
_isPaused = true; |
|||
_activePlayableDirector.playableGraph.GetRootPlayable(0).SetSpeed(0); |
|||
} |
|||
|
|||
public void ResumeTimeline() |
|||
{ |
|||
_isPaused = false; |
|||
_activePlayableDirector.playableGraph.GetRootPlayable(0).SetSpeed(1); |
|||
} |
|||
|
|||
private void EnableDialogueInput() |
|||
{ |
|||
_inputReader.gameInput.Dialogues.Enable(); |
|||
_inputReader.gameInput.Gameplay.Disable(); |
|||
} |
|||
|
|||
private void EnableGameplayInput() |
|||
{ |
|||
_inputReader.gameInput.Gameplay.Enable(); |
|||
_inputReader.gameInput.Dialogues.Disable(); |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 51755885c3e549b6b9c0a42acba7a0e8 |
|||
timeCreated: 1601935207 |
|
|||
using UnityEngine; |
|||
using UnityEngine.Playables; |
|||
|
|||
/// <summary>
|
|||
/// Class to trigger a cutscene.
|
|||
/// </summary>
|
|||
|
|||
public class CutsceneTrigger : MonoBehaviour |
|||
{ |
|||
[SerializeField] private CutsceneManager _cutsceneManager = default; |
|||
[SerializeField] private PlayableDirector _playableDirector = default; |
|||
[SerializeField] private bool _playOnStart = default; |
|||
[SerializeField] private bool _playOnce = default; |
|||
|
|||
private void Start() |
|||
{ |
|||
if(_playOnStart) |
|||
_cutsceneManager.PlayCutscene(_playableDirector); |
|||
} |
|||
|
|||
private void OnTriggerEnter(Collider other) |
|||
{ |
|||
_cutsceneManager.PlayCutscene(_playableDirector); |
|||
|
|||
if(_playOnce) |
|||
Destroy(this); |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: a1b57f138bf282148942d40c320dc9ba |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 43bce16eee76bb640a0e03fe45e0536b |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using UnityEngine; |
|||
using UnityEngine.Playables; |
|||
|
|||
[Serializable] |
|||
public class DialogueBehaviour : PlayableBehaviour |
|||
{ |
|||
[SerializeField] private DialogueLineSO _dialogueLine = default; |
|||
[SerializeField] private bool _pauseWhenClipEnds = default; //This won't work if the clip ends on the very last frame of the Timeline
|
|||
|
|||
[HideInInspector] public CutsceneManager cutsceneManager; |
|||
|
|||
private bool _dialoguePlayed; |
|||
|
|||
/// <summary>
|
|||
/// Displays a line of dialogue on screen by interfacing with the <c>CutsceneManager</c>. This happens as soon as the playhead reaches the clip.
|
|||
/// </summary>
|
|||
public override void OnBehaviourPlay(Playable playable, FrameData info) |
|||
{ |
|||
if(_dialoguePlayed) return; |
|||
|
|||
// Need to ask the CutsceneManager if the cutscene is playing, since the graph is not actually stopped/paused: it's just going at speed 0
|
|||
// This check is needed because when two clips are side by side and the first one stops the cutscene,
|
|||
// the OnBehaviourPlay of the second clip is still called and thus its dialogueLine is played (prematurely). This check makes sure it's not.
|
|||
if(playable.GetGraph().IsPlaying() |
|||
&& cutsceneManager.IsCutscenePlaying) |
|||
{ |
|||
//TODO: Find a way to "play" dialogue lines even when scrubbing the Timeline not in Play Mode
|
|||
if(_dialogueLine != null) |
|||
{ |
|||
cutsceneManager.PlayDialogueFromClip(_dialogueLine); |
|||
_dialoguePlayed = true; |
|||
} |
|||
else |
|||
{ |
|||
Debug.LogWarning("This clip contains no DialogueLine"); |
|||
} |
|||
} |
|||
} |
|||
|
|||
public override void OnBehaviourPause(Playable playable, FrameData info) |
|||
{ |
|||
// The check on _dialoguePlayed is needed because OnBehaviourPause is called also at the beginning of the Timeline,
|
|||
// so we need to make sure that the Timeline has actually gone through this clip (i.e. called OnBehaviourPlay) at least once before we stop it
|
|||
if (Application.isPlaying |
|||
&& playable.GetGraph().IsPlaying() |
|||
&& !playable.GetGraph().GetRootPlayable(0).IsDone() |
|||
&& _dialoguePlayed) |
|||
{ |
|||
if(_pauseWhenClipEnds) |
|||
cutsceneManager.PauseTimeline(); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 8141522e5872ae344a717a127dcb0821 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using UnityEngine; |
|||
using UnityEngine.Playables; |
|||
using UnityEngine.Timeline; |
|||
|
|||
public class DialogueClip : PlayableAsset, ITimelineClipAsset |
|||
{ |
|||
[SerializeField] private DialogueBehaviour _template = default; |
|||
[HideInInspector] public CutsceneManager cutsceneManager; |
|||
|
|||
// Having ClipCaps set to None makes sure that the clips can't be blended, extrapolated, looped, etc.
|
|||
public ClipCaps clipCaps |
|||
{ |
|||
get { return ClipCaps.None; } |
|||
} |
|||
|
|||
public override Playable CreatePlayable(PlayableGraph graph, GameObject owner) |
|||
{ |
|||
_template.cutsceneManager = cutsceneManager; |
|||
ScriptPlayable<DialogueBehaviour> playable = ScriptPlayable<DialogueBehaviour>.Create(graph, _template); |
|||
|
|||
return playable; |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 12176dee71327c74498b489e9029a0ee |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using UnityEngine.Playables; |
|||
|
|||
/// <summary>
|
|||
/// This <c>MixerBehaviour</c> is actually unused by the track for now, since <c>DialogueClip</c> don't need mixing.
|
|||
/// </summary>
|
|||
public class DialogueMixerBehaviour : PlayableBehaviour |
|||
{ |
|||
|
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 97b7dcaa71cbfa94795838d9b1521656 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using UnityEngine; |
|||
using UnityEngine.Playables; |
|||
using UnityEngine.Timeline; |
|||
|
|||
[TrackBindingType(typeof(CutsceneManager))] |
|||
[TrackClipType(typeof(DialogueClip))] |
|||
public class DialogueTrack : PlayableTrack |
|||
{ |
|||
public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount) |
|||
{ |
|||
CutsceneManager cutsceneManagerRef = go.GetComponent<PlayableDirector>().GetGenericBinding(this) as CutsceneManager; |
|||
|
|||
foreach (TimelineClip clip in GetClips()) |
|||
{ |
|||
DialogueClip dialogueControlClip = clip.asset as DialogueClip; |
|||
dialogueControlClip.cutsceneManager = cutsceneManagerRef; |
|||
} |
|||
|
|||
return base.CreateTrackMixer(graph, go, inputCount); |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 88bc95ff4e1f12c43a4672c8a05feaf4 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using UnityEngine; |
|||
|
|||
/// <summary>
|
|||
/// Scriptable Object that represents an "Actor", that is the protagonist of a Dialogue
|
|||
/// </summary>
|
|||
|
|||
[CreateAssetMenu(fileName = "newActor", menuName = "Dialogues/Actor")] |
|||
public class ActorSO : ScriptableObject |
|||
{ |
|||
public string ActorName { get => _actorName; } |
|||
|
|||
[SerializeField] private string _actorName = default; |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: f991c0f5eb9677944ae00c1b61548e72 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Collections.Generic; |
|||
using UnityEngine; |
|||
using UnityEngine.Timeline; |
|||
|
|||
/// <summary>
|
|||
/// A Dialogue is a list of consecutive DialogueLines. They play in sequence using the input of the player to skip forward.
|
|||
/// In future versions it might contain support for branching conversations.
|
|||
/// </summary>
|
|||
[CreateAssetMenu(fileName = "newDialogue", menuName = "CutsceneSystem/Dialogue Data")] |
|||
public class DialogueDataSO : ScriptableObject |
|||
{ |
|||
public List<DialogueLineSO> dialogueLines; |
|||
|
|||
//TODO: Add support for branching conversations
|
|||
// Maybe add 2 (or more) special line slots which represent a choice in a conversation
|
|||
// Each line would also have an event associated, or another Dialogue
|
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: a0c0171b565b4074a9462307824be26c |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using UnityEngine; |
|||
|
|||
/// <summary>
|
|||
/// DialogueLine is a Scriptable Object that represents one line of spoken dialogue.
|
|||
/// It references the Actor that speaks it.
|
|||
/// </summary>
|
|||
[CreateAssetMenu(fileName = "newLineOfDialogue", menuName = "Dialogues/Line of Dialogue")] |
|||
public class DialogueLineSO : ScriptableObject |
|||
{ |
|||
public ActorSO Actor { get => _actor; } |
|||
public string Sentence { get => _sentence; } |
|||
|
|||
[SerializeField] private ActorSO _actor = default; |
|||
[SerializeField] [TextArea(3, 3)] private string _sentence = default; //TODO: Connect this with localisation
|
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: e49a73eb0802e10429213abfb59e46e1 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using UnityEngine; |
|||
|
|||
/// <summary>
|
|||
/// Takes care of all things dialogue, whether they are coming from within a Timeline or just from the interaction with a character, or by any other mean.
|
|||
/// Keeps track of choices in the dialogue (if any) and then gives back control to gameplay when appropriate.
|
|||
/// </summary>
|
|||
public class DialogueManager : MonoBehaviour |
|||
{ |
|||
[SerializeField] private InputReader _inputReader = default; |
|||
|
|||
/// <summary>
|
|||
/// Called to begin a dialogue, i.e. a sequence of lines that require the player's input to move forward.
|
|||
/// </summary>
|
|||
/// <param name="firstLine"></param>
|
|||
public void BeginDialogue(DialogueLineSO firstLine) |
|||
{ |
|||
_inputReader.gameInput.Dialogues.Enable(); |
|||
|
|||
DisplayDialogueLine(firstLine); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Displays a line of dialogue in the UI, by requesting it to the <c>DialogueManager</c>.
|
|||
/// This function is also called by <c>DialogueBehaviour</c> from clips on Timeline during cutscenes.
|
|||
/// </summary>
|
|||
/// <param name="dialogueLine"></param>
|
|||
public void DisplayDialogueLine(DialogueLineSO dialogueLine) |
|||
{ |
|||
//TODO: Interface with a UIManager to allow displayal of the line of dialogue in the UI
|
|||
Debug.Log("A line of dialogue has been spoken: \"" + dialogueLine.Sentence + "\" by " + dialogueLine.Actor.ActorName); |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: e1faa963712171c468c0ea8746754bf6 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 38702c2aaaecea94bab6e80021a4633e |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
/* |
|||
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Reflection; |
|||
using UnityEditor; |
|||
using UnityEngine; |
|||
|
|||
/// <summary>
|
|||
/// <see cref="DialogueDataSO"/> editor that draw default inspector except:
|
|||
/// <list type="bullet">
|
|||
/// <item><see cref="DialogueDataSO.Conversation"/></item>.
|
|||
/// </list>
|
|||
/// </summary>
|
|||
|
|||
[CustomEditor(typeof(DialogueDataSO))] |
|||
public class DialogueDataEditor : Editor |
|||
{ |
|||
private readonly Type _dialogueData = typeof(DialogueDataSO); |
|||
|
|||
/// <summary>
|
|||
/// All serialized fields in <see cref="DialogueDataSO"/>
|
|||
/// </summary>
|
|||
private readonly List<SerializedProperty> _serializedFields = new List<SerializedProperty>(); |
|||
private ReorderableList _dialogueList; |
|||
|
|||
|
|||
private void OnEnable() |
|||
{ |
|||
PrepareSerializedProperties(); |
|||
} |
|||
|
|||
public override void OnInspectorGUI() |
|||
{ |
|||
DrawCustomInspector(); |
|||
} |
|||
|
|||
|
|||
private void DrawCustomInspector() |
|||
{ |
|||
// Make GUI not changeable.
|
|||
GUI.enabled = false; |
|||
|
|||
// Draw reference information about script being edited.
|
|||
EditorGUILayout.ObjectField("Script", MonoScript.FromScriptableObject((DialogueDataSO)target), typeof(DialogueDataSO), false); |
|||
|
|||
// Make GUI changeable
|
|||
GUI.enabled = true; |
|||
|
|||
serializedObject.Update(); |
|||
|
|||
// Draw field to display
|
|||
foreach (SerializedProperty field in _serializedFields) |
|||
{ |
|||
if (field != null) |
|||
{ |
|||
if (field.name == nameof(DialogueDataSO.Conversation)) |
|||
{ |
|||
_dialogueList.DoLayoutList(); |
|||
} |
|||
else // Draw Default property fields.
|
|||
{ |
|||
EditorGUILayout.PropertyField(field); |
|||
} |
|||
} |
|||
} |
|||
|
|||
serializedObject.ApplyModifiedProperties(); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Identify all serialized property from selected <see cref="DialogueDataSO"/>
|
|||
/// </summary>
|
|||
private void PrepareSerializedProperties() |
|||
{ |
|||
// Prepare serialized property.
|
|||
FieldInfo[] fields = _dialogueData.GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); |
|||
|
|||
foreach (FieldInfo field in fields) |
|||
{ |
|||
SerializedProperty serializedProperty = serializedObject.FindProperty(field.Name); |
|||
|
|||
_serializedFields.Add(serializedProperty); |
|||
|
|||
if (field.Name == nameof(DialogueDataSO.Conversation)) |
|||
{ |
|||
_dialogueList = new ReorderableList(serializedProperty); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
*/ |
|
|||
fileFormatVersion: 2 |
|||
guid: 1198bb82bd24ceb40871ed4dda0f9122 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue