From 581eb102d540bc495ec62dae25fcea0d676d1a59 Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Mon, 24 Aug 2020 00:14:06 -0400 Subject: Dialogue; Unlock cursor --- Assets/Input/PlayerControls.cs | 29 ++ Assets/Input/PlayerControls.inputactions | 19 ++ Assets/Scenes/SampleScene.unity | 412 +++++++++++++++++++++++- Assets/Scripts/Dialogue.meta | 8 + Assets/Scripts/Dialogue/Dialogue.cs | 12 + Assets/Scripts/Dialogue/Dialogue.cs.meta | 11 + Assets/Scripts/Dialogue/DialogueManager.cs | 21 ++ Assets/Scripts/Dialogue/DialogueManager.cs.meta | 11 + Assets/Scripts/Dialogue/DialogueTrigger.cs | 13 + Assets/Scripts/Dialogue/DialogueTrigger.cs.meta | 11 + Assets/Scripts/UnlockCursor.cs | 22 ++ Assets/Scripts/UnlockCursor.cs.meta | 11 + 12 files changed, 569 insertions(+), 11 deletions(-) create mode 100644 Assets/Scripts/Dialogue.meta create mode 100644 Assets/Scripts/Dialogue/Dialogue.cs create mode 100644 Assets/Scripts/Dialogue/Dialogue.cs.meta create mode 100644 Assets/Scripts/Dialogue/DialogueManager.cs create mode 100644 Assets/Scripts/Dialogue/DialogueManager.cs.meta create mode 100644 Assets/Scripts/Dialogue/DialogueTrigger.cs create mode 100644 Assets/Scripts/Dialogue/DialogueTrigger.cs.meta create mode 100644 Assets/Scripts/UnlockCursor.cs create mode 100644 Assets/Scripts/UnlockCursor.cs.meta (limited to 'Assets') diff --git a/Assets/Input/PlayerControls.cs b/Assets/Input/PlayerControls.cs index 9a30182..4a60a06 100644 --- a/Assets/Input/PlayerControls.cs +++ b/Assets/Input/PlayerControls.cs @@ -41,6 +41,14 @@ public class @PlayerControls : IInputActionCollection, IDisposable ""expectedControlType"": ""Button"", ""processors"": """", ""interactions"": """" + }, + { + ""name"": ""UnlockCursor"", + ""type"": ""Button"", + ""id"": ""9245a8ae-c817-4f60-9b78-f639dd4a52f0"", + ""expectedControlType"": ""Button"", + ""processors"": """", + ""interactions"": """" } ], ""bindings"": [ @@ -230,6 +238,17 @@ public class @PlayerControls : IInputActionCollection, IDisposable ""action"": ""Look"", ""isComposite"": false, ""isPartOfComposite"": true + }, + { + ""name"": """", + ""id"": ""5fe61161-b433-47e3-b01b-f299068b92ae"", + ""path"": ""/f1"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Keyboard and Mouse"", + ""action"": ""UnlockCursor"", + ""isComposite"": false, + ""isPartOfComposite"": false } ] } @@ -269,6 +288,7 @@ public class @PlayerControls : IInputActionCollection, IDisposable m_Gameplay_Move = m_Gameplay.FindAction("Move", throwIfNotFound: true); m_Gameplay_Jump = m_Gameplay.FindAction("Jump", throwIfNotFound: true); m_Gameplay_Look = m_Gameplay.FindAction("Look", throwIfNotFound: true); + m_Gameplay_UnlockCursor = m_Gameplay.FindAction("UnlockCursor", throwIfNotFound: true); } public void Dispose() @@ -321,6 +341,7 @@ public class @PlayerControls : IInputActionCollection, IDisposable private readonly InputAction m_Gameplay_Move; private readonly InputAction m_Gameplay_Jump; private readonly InputAction m_Gameplay_Look; + private readonly InputAction m_Gameplay_UnlockCursor; public struct GameplayActions { private @PlayerControls m_Wrapper; @@ -328,6 +349,7 @@ public class @PlayerControls : IInputActionCollection, IDisposable public InputAction @Move => m_Wrapper.m_Gameplay_Move; public InputAction @Jump => m_Wrapper.m_Gameplay_Jump; public InputAction @Look => m_Wrapper.m_Gameplay_Look; + public InputAction @UnlockCursor => m_Wrapper.m_Gameplay_UnlockCursor; public InputActionMap Get() { return m_Wrapper.m_Gameplay; } public void Enable() { Get().Enable(); } public void Disable() { Get().Disable(); } @@ -346,6 +368,9 @@ public class @PlayerControls : IInputActionCollection, IDisposable @Look.started -= m_Wrapper.m_GameplayActionsCallbackInterface.OnLook; @Look.performed -= m_Wrapper.m_GameplayActionsCallbackInterface.OnLook; @Look.canceled -= m_Wrapper.m_GameplayActionsCallbackInterface.OnLook; + @UnlockCursor.started -= m_Wrapper.m_GameplayActionsCallbackInterface.OnUnlockCursor; + @UnlockCursor.performed -= m_Wrapper.m_GameplayActionsCallbackInterface.OnUnlockCursor; + @UnlockCursor.canceled -= m_Wrapper.m_GameplayActionsCallbackInterface.OnUnlockCursor; } m_Wrapper.m_GameplayActionsCallbackInterface = instance; if (instance != null) @@ -359,6 +384,9 @@ public class @PlayerControls : IInputActionCollection, IDisposable @Look.started += instance.OnLook; @Look.performed += instance.OnLook; @Look.canceled += instance.OnLook; + @UnlockCursor.started += instance.OnUnlockCursor; + @UnlockCursor.performed += instance.OnUnlockCursor; + @UnlockCursor.canceled += instance.OnUnlockCursor; } } } @@ -386,5 +414,6 @@ public class @PlayerControls : IInputActionCollection, IDisposable void OnMove(InputAction.CallbackContext context); void OnJump(InputAction.CallbackContext context); void OnLook(InputAction.CallbackContext context); + void OnUnlockCursor(InputAction.CallbackContext context); } } diff --git a/Assets/Input/PlayerControls.inputactions b/Assets/Input/PlayerControls.inputactions index ed52073..e18714b 100644 --- a/Assets/Input/PlayerControls.inputactions +++ b/Assets/Input/PlayerControls.inputactions @@ -28,6 +28,14 @@ "expectedControlType": "Button", "processors": "", "interactions": "" + }, + { + "name": "UnlockCursor", + "type": "Button", + "id": "9245a8ae-c817-4f60-9b78-f639dd4a52f0", + "expectedControlType": "Button", + "processors": "", + "interactions": "" } ], "bindings": [ @@ -217,6 +225,17 @@ "action": "Look", "isComposite": false, "isPartOfComposite": true + }, + { + "name": "", + "id": "5fe61161-b433-47e3-b01b-f299068b92ae", + "path": "/f1", + "interactions": "", + "processors": "", + "groups": "Keyboard and Mouse", + "action": "UnlockCursor", + "isComposite": false, + "isPartOfComposite": false } ] } diff --git a/Assets/Scenes/SampleScene.unity b/Assets/Scenes/SampleScene.unity index c064b07..c132b9f 100644 --- a/Assets/Scenes/SampleScene.unity +++ b/Assets/Scenes/SampleScene.unity @@ -200,6 +200,272 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 73638133} m_CullTransparentMesh: 0 +--- !u!1 &138210409 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 138210410} + - component: {fileID: 138210414} + - component: {fileID: 138210413} + - component: {fileID: 138210412} + - component: {fileID: 138210411} + m_Layer: 5 + m_Name: DialogueButton + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &138210410 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 138210409} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1603614688} + m_Father: {fileID: 1343977746} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 1} + m_AnchorMax: {x: 0.5, y: 1} + m_AnchoredPosition: {x: 0, y: -52} + m_SizeDelta: {x: 160, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &138210411 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 138210409} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e5575ce16db5683b796e3a9db6a8a0e1, type: 3} + m_Name: + m_EditorClassIdentifier: + dialogue: + name: John Doe + sentences: + - Hello world! + - This is a test! + - This feature will be in Project Sandbox! +--- !u!114 &138210412 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 138210409} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 138210413} + m_OnClick: + m_PersistentCalls: + m_Calls: + - m_Target: {fileID: 138210411} + m_MethodName: TriggerDialogue + m_Mode: 1 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: + m_BoolArgument: 0 + m_CallState: 2 +--- !u!114 &138210413 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 138210409} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!222 &138210414 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 138210409} + m_CullTransparentMesh: 0 +--- !u!1 &192977404 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 192977405} + - component: {fileID: 192977407} + - component: {fileID: 192977406} + m_Layer: 5 + m_Name: Dialogue + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &192977405 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 192977404} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1343977746} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 1.2999878, y: -169.48999} + m_SizeDelta: {x: -504.12933, y: -338.98358} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &192977406 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 192977404} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 0.392} + m_RaycastTarget: 1 + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!222 &192977407 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 192977404} + m_CullTransparentMesh: 0 +--- !u!1 &519581754 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 519581755} + - component: {fileID: 519581756} + m_Layer: 0 + m_Name: DialogueManager + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &519581755 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 519581754} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 600.20557, y: 82.246574, z: -66.43719} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &519581756 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 519581754} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0c8e9050d46a64b3a833517e2db4a78b, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &701464655 GameObject: m_ObjectHideFlags: 0 @@ -308,7 +574,7 @@ Transform: m_LocalScale: {x: 3, y: 3, z: 3} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 10 + m_RootOrder: 12 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &705507993 GameObject: @@ -400,7 +666,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 3 + m_RootOrder: 5 m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} --- !u!1 &832029363 GameObject: @@ -585,7 +851,7 @@ Transform: m_LocalScale: {x: 1, y: 0.3609, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 8 + m_RootOrder: 10 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &895538662 GameObject: @@ -706,6 +972,50 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 895538662} m_CullTransparentMesh: 0 +--- !u!1 &1010888048 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1010888050} + - component: {fileID: 1010888049} + m_Layer: 0 + m_Name: CursorUnlocked + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1010888049 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1010888048} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d447635ba689deb97b1b5141635f8738, type: 3} + m_Name: + m_EditorClassIdentifier: + lockCursor: 1 +--- !u!4 &1010888050 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1010888048} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 417.8942, y: 377.206, z: -232.20137} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1133956157 GameObject: m_ObjectHideFlags: 0 @@ -873,7 +1183,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 22451668, guid: 0abab5bb77339e4428787a870eb31bd3, type: 3} propertyPath: m_RootOrder - value: 1 + value: 3 objectReference: {fileID: 0} - target: {fileID: 22451668, guid: 0abab5bb77339e4428787a870eb31bd3, type: 3} propertyPath: m_LocalEulerAnglesHint.x @@ -1069,7 +1379,7 @@ Transform: m_LocalScale: {x: 1, y: 0.5, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 9 + m_RootOrder: 11 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1343977742 GameObject: @@ -1163,8 +1473,10 @@ RectTransform: m_Children: - {fileID: 1133956158} - {fileID: 832029364} + - {fileID: 192977405} + - {fileID: 138210410} m_Father: {fileID: 0} - m_RootOrder: 2 + m_RootOrder: 4 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -1212,8 +1524,86 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 5 + m_RootOrder: 7 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1603614687 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1603614688} + - component: {fileID: 1603614690} + - component: {fileID: 1603614689} + m_Layer: 5 + m_Name: TestButton + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1603614688 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1603614687} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 138210410} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1603614689 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1603614687} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_RaycastTarget: 1 + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Test Button +--- !u!222 &1603614690 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1603614687} + m_CullTransparentMesh: 0 --- !u!1 &1704194732 GameObject: m_ObjectHideFlags: 0 @@ -1305,7 +1695,7 @@ Transform: m_LocalScale: {x: 100, y: 1, z: 100} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 6 + m_RootOrder: 8 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!23 &423103507109781297 MeshRenderer: @@ -1444,7 +1834,7 @@ PrefabInstance: - target: {fileID: 990268100192312561, guid: 61c68b207aaeb438fa625409d4c9247e, type: 3} propertyPath: m_RootOrder - value: 7 + value: 9 objectReference: {fileID: 0} - target: {fileID: 990268100192312561, guid: 61c68b207aaeb438fa625409d4c9247e, type: 3} @@ -1502,7 +1892,7 @@ Transform: - {fileID: 2609934725419204965} - {fileID: 6029319940320598495} m_Father: {fileID: 0} - m_RootOrder: 4 + m_RootOrder: 6 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1946170699347181754 GameObject: @@ -1680,7 +2070,7 @@ PrefabInstance: - target: {fileID: 8450095133606623982, guid: 8489462a89be80c6e91509d42a08b050, type: 3} propertyPath: m_RootOrder - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 8450095133606623982, guid: 8489462a89be80c6e91509d42a08b050, type: 3} diff --git a/Assets/Scripts/Dialogue.meta b/Assets/Scripts/Dialogue.meta new file mode 100644 index 0000000..9916df6 --- /dev/null +++ b/Assets/Scripts/Dialogue.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5fcc17da87c829e7dae5e6566ac60ae2 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Dialogue/Dialogue.cs b/Assets/Scripts/Dialogue/Dialogue.cs new file mode 100644 index 0000000..bf2c960 --- /dev/null +++ b/Assets/Scripts/Dialogue/Dialogue.cs @@ -0,0 +1,12 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +[System.Serializable] +public class Dialogue +{ + public string name; + + [TextArea(3, 10)] + public string[] sentences; +} diff --git a/Assets/Scripts/Dialogue/Dialogue.cs.meta b/Assets/Scripts/Dialogue/Dialogue.cs.meta new file mode 100644 index 0000000..06fe34a --- /dev/null +++ b/Assets/Scripts/Dialogue/Dialogue.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c51f13272531bf313b4525ab297ca9b8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Dialogue/DialogueManager.cs b/Assets/Scripts/Dialogue/DialogueManager.cs new file mode 100644 index 0000000..056e7d9 --- /dev/null +++ b/Assets/Scripts/Dialogue/DialogueManager.cs @@ -0,0 +1,21 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class DialogueManager : MonoBehaviour +{ + + private Queue sentences; + + // Start is called before the first frame update + void Start() + { + sentences = new Queue(); + } + + public void StartDialogue(Dialogue dialogue) + { + Debug.Log("Starting conversation with " + dialogue.name); + } + +} diff --git a/Assets/Scripts/Dialogue/DialogueManager.cs.meta b/Assets/Scripts/Dialogue/DialogueManager.cs.meta new file mode 100644 index 0000000..c4089d4 --- /dev/null +++ b/Assets/Scripts/Dialogue/DialogueManager.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0c8e9050d46a64b3a833517e2db4a78b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Dialogue/DialogueTrigger.cs b/Assets/Scripts/Dialogue/DialogueTrigger.cs new file mode 100644 index 0000000..3ca0ae1 --- /dev/null +++ b/Assets/Scripts/Dialogue/DialogueTrigger.cs @@ -0,0 +1,13 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class DialogueTrigger : MonoBehaviour +{ + public Dialogue dialogue; + + public void TriggerDialogue() + { + FindObjectOfType().StartDialogue(dialogue); + } +} diff --git a/Assets/Scripts/Dialogue/DialogueTrigger.cs.meta b/Assets/Scripts/Dialogue/DialogueTrigger.cs.meta new file mode 100644 index 0000000..3d54ac1 --- /dev/null +++ b/Assets/Scripts/Dialogue/DialogueTrigger.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e5575ce16db5683b796e3a9db6a8a0e1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/UnlockCursor.cs b/Assets/Scripts/UnlockCursor.cs new file mode 100644 index 0000000..3f3812c --- /dev/null +++ b/Assets/Scripts/UnlockCursor.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class UnlockCursor : MonoBehaviour +{ + public bool lockCursor = true; + // Update is called once per frame + void Update() + { + if (Input.GetKeyDown(KeyCode.F1)) + { + lockCursor = !lockCursor; + } + + Cursor.lockState = lockCursor ? CursorLockMode.Locked : CursorLockMode.None; + Cursor.visible = !lockCursor; + + } + +} diff --git a/Assets/Scripts/UnlockCursor.cs.meta b/Assets/Scripts/UnlockCursor.cs.meta new file mode 100644 index 0000000..45cf829 --- /dev/null +++ b/Assets/Scripts/UnlockCursor.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d447635ba689deb97b1b5141635f8738 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: -- cgit v1.2.3