diff --git a/Assets/SZZ/Code/Scripts/Dialogue/DialogueHolder.cs b/Assets/SZZ/Code/Scripts/Dialogue/DialogueHolder.cs index 477499e957b9ddcc027a20b4b3daa94ddef0ac78..ad0c86427004d67056627122bea01842376cfd66 100644 --- a/Assets/SZZ/Code/Scripts/Dialogue/DialogueHolder.cs +++ b/Assets/SZZ/Code/Scripts/Dialogue/DialogueHolder.cs @@ -5,11 +5,11 @@ using Ink.Runtime; public class DialogueHolder : MonoBehaviour { - [SerializeField] private TextAsset inkJSON; - [SerializeField] private UnityEvent<Story> onStart; - [SerializeField] private UnityEvent<Story> onChoice; - [SerializeField] private UnityEvent<Story> onBreak; - [SerializeField] private UnityEvent<Story> onFinish; + [SerializeField] public TextAsset inkJSON; + [SerializeField] public UnityEvent<Story> onStart; + [SerializeField] public UnityEvent<Story> onChoice; + [SerializeField] public UnityEvent<Story> onBreak; + [SerializeField] public UnityEvent<Story> onFinish; private DialogueManager dialogueManager; diff --git a/Assets/SZZ/Code/Scripts/Level/Level1Controller.cs b/Assets/SZZ/Code/Scripts/Level/Level1Controller.cs index 2e35941686bddb74c6d151c0ae20c2df0494f343..ed951532cc0e5d3c7395e3d8d2f0eb2a12c87feb 100644 --- a/Assets/SZZ/Code/Scripts/Level/Level1Controller.cs +++ b/Assets/SZZ/Code/Scripts/Level/Level1Controller.cs @@ -5,17 +5,26 @@ using UnityEngine; public class Level1Controller : MonoBehaviour { + [Header("UI")] [SerializeField] private string cheatCountFieldPrefix = "ZvednutĂ© taháky: "; [SerializeField] private TMP_Text cheatCountField; [SerializeField] private Image cheatCountImageContainer; [SerializeField] private Sprite[] cheatCountImages; + + [Header("Timer")] [SerializeField] private Timer timer; [SerializeField] private float timerLength = 100; + [Header("Self dialogue")] + [SerializeField] private TextAsset maxCheatsInkJSON; + private GameState game; + private View view; + private void Start() { game = GameState.GetInstance(); + view = View.GetInstance(); game.currentQuest = "! Najdi na patĹ™e zapomenutĂ© taháky. Nenech. Se. Chytit."; timer.Run(timerLength, () => { game.StartLevel2(); }); @@ -46,9 +55,8 @@ public void PickupCheat() { SetImage(game.cheatsPickedUp); - if (game.cheatsPickedUp >= game.maxCheats) { - // TODO play dialogue - } + if (game.cheatsPickedUp >= game.maxCheats) + view.player.PlaySelfDialogue(maxCheatsInkJSON); } private void SetImage(int index) { diff --git a/Assets/SZZ/Code/Scripts/Level/Timer.cs b/Assets/SZZ/Code/Scripts/Level/Timer.cs index 19d207bd8fe7abdc25bd8013ef193f3ee1512c4d..0e2c67f3c1ce4e9c528cd6ab4739dd7b7aed0919 100644 --- a/Assets/SZZ/Code/Scripts/Level/Timer.cs +++ b/Assets/SZZ/Code/Scripts/Level/Timer.cs @@ -25,10 +25,10 @@ void Start() { void Update() { if (!running) return; - if (remainingTime - Time.deltaTime > 0){ + if (remainingTime - Time.deltaTime > 0) { remainingTime -= Time.deltaTime; - PlayHeartbeat(); - } + PlayHeartbeat(); + } else { remainingTime = 0; running = false; @@ -55,9 +55,8 @@ private void PlayHeartbeat() { if (remainingTime <= fashHeartbeatThreshold) source = remainingTime > fashHeartbeatThreshold / 2 ? heartbeatSources[1] : heartbeatSources[2]; - if(!backgroundAudioController.currentAudio.isPlaying || backgroundAudioController.currentAudio == backgroundAudioController.OSTSource){ - Debug.Log("Play heartbeat"); + if (!backgroundAudioController.currentAudio.isPlaying || backgroundAudioController.currentAudio == backgroundAudioController.OSTSource) { backgroundAudioController.Play(source, () => PlayHeartbeat()); - } + } } } diff --git a/Assets/SZZ/Code/Scripts/Player/Player.cs b/Assets/SZZ/Code/Scripts/Player/Player.cs index ebece4c57deffe8ac3e8d6d23262786299bd9338..c848e9aab5674d74997c7d2ecfd22e5a8861772f 100644 --- a/Assets/SZZ/Code/Scripts/Player/Player.cs +++ b/Assets/SZZ/Code/Scripts/Player/Player.cs @@ -3,7 +3,19 @@ using UnityEngine; using UnityEngine.InputSystem; +[RequireComponent(typeof(DialogueHolder))] public class Player : MonoBehaviour { [SerializeField] private GameObject _cameraRoot; public GameObject cameraRoot { get { return _cameraRoot; } } + + private DialogueHolder dialogueHolder; + + private void Awake() { + dialogueHolder = GetComponent<DialogueHolder>(); + } + + public void PlaySelfDialogue(TextAsset inkJSON) { + dialogueHolder.inkJSON = inkJSON; + dialogueHolder.Play(); + } } diff --git a/Assets/SZZ/Code/Scripts/Player/PlayerInteractUI.cs b/Assets/SZZ/Code/Scripts/Player/PlayerInteractUI.cs index 24a0e470218564ea53b51a17ebd0a5aef7392350..1a9e4a9a09e9f9c4d3de4304cf1050e62a49ebff 100644 --- a/Assets/SZZ/Code/Scripts/Player/PlayerInteractUI.cs +++ b/Assets/SZZ/Code/Scripts/Player/PlayerInteractUI.cs @@ -33,13 +33,13 @@ private void FixedUpdate() { showPayRespactsPrompt = lookedAtPayRespects is not null; if (playerActionsController.interactionTrigger is not null) - showInteractionPrompt = !dialogueManager.dialogueIsPlaying; + showInteractionPrompt = true; } private void Update() { - TogglePrompt(interactPrompt, showInteractionPrompt); - TogglePrompt(payRespectsPrompt, showPayRespactsPrompt); + TogglePrompt(interactPrompt, showInteractionPrompt && !dialogueManager.dialogueIsPlaying); + TogglePrompt(payRespectsPrompt, showPayRespactsPrompt && !dialogueManager.dialogueIsPlaying); } private void TogglePrompt(GameObject obj, bool active) { diff --git a/Assets/SZZ/Code/Scripts/View.cs b/Assets/SZZ/Code/Scripts/View.cs index 0b0f252d55311bece8db3249dea3533ed7b34fbe..bea452f65b03b47765ae120188869bc4969776c8 100644 --- a/Assets/SZZ/Code/Scripts/View.cs +++ b/Assets/SZZ/Code/Scripts/View.cs @@ -9,6 +9,9 @@ public class View : MonoBehaviour { private static View instance; + [SerializeField] private Player _player; + public Player player { get { return _player; } } + [SerializeField] private PlayerInput _playerInput; public PlayerInput playerInput { get { return _playerInput; } } diff --git a/Assets/SZZ/Dialogue/Adela.ink b/Assets/SZZ/Dialogue/Adela.ink index cc8db0dc605ec80ed98244e1204df2ae5123afa5..6acd6af91ab34cdcb9f0c5938046c85fd4aab9ea 100644 --- a/Assets/SZZ/Dialogue/Adela.ink +++ b/Assets/SZZ/Dialogue/Adela.ink @@ -42,4 +42,5 @@ To je snad vše, tak hodnÄ› štÄ›stĂ a moc se nebojte… bolĂ to jen trochu. Kdybyste ještÄ› potĹ™eboval nÄ›co vysvÄ›tlit, nebojte se zastavit, jsem tady pro Vás. [MÄ›l bych se rychle podĂvat, jestli tady nÄ›kdo nezapomnÄ›l nÄ›co, co by se mi mohlo hodit. Hmm, za co asi chytli všechny ty nebožáky kolem...] + -> END diff --git a/Assets/SZZ/Dialogue/Self/level1-start.ink b/Assets/SZZ/Dialogue/Self/level1-start.ink deleted file mode 100644 index b9f9701ddbeacf45ceb9bb1a377e903bb80be201..0000000000000000000000000000000000000000 --- a/Assets/SZZ/Dialogue/Self/level1-start.ink +++ /dev/null @@ -1,3 +0,0 @@ -MÄ›l bych se rychle podĂvat, jestli tady nÄ›kdo nezapomnÄ›l nÄ›co, co by se mi mohlo hodit. Hmm, za co asi chytli všechny ty nebožáky kolem... - --> END diff --git a/Assets/SZZ/Dialogue/Self/level1-start.ink.meta b/Assets/SZZ/Dialogue/Self/level1-start.ink.meta deleted file mode 100644 index eafbc3386ae1bbf847ef124adcfea89c2239f520..0000000000000000000000000000000000000000 --- a/Assets/SZZ/Dialogue/Self/level1-start.ink.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 2fa6b4d0470aebd4098f7b4dfbac9e3a -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/SZZ/Dialogue/Self/level1-start.json b/Assets/SZZ/Dialogue/Self/level1-start.json deleted file mode 100644 index 0fc2937c6d9ab89c497628105ee97dac706f8a22..0000000000000000000000000000000000000000 --- a/Assets/SZZ/Dialogue/Self/level1-start.json +++ /dev/null @@ -1 +0,0 @@ -{"inkVersion":20,"root":[["^MÄ›l bych se rychle podĂvat, jestli tady nÄ›kdo nezapomnÄ›l nÄ›co, co by se mi mohlo hodit. Hmm, za co asi chytli všechny ty nebožáky kolem...","\n","end",["done",{"#f":5,"#n":"g-0"}],null],"done",{"#f":1}],"listDefs":{}} \ No newline at end of file diff --git a/Assets/SZZ/Dialogue/Self/level1-start.json.meta b/Assets/SZZ/Dialogue/Self/level1-start.json.meta deleted file mode 100644 index f55ae7acef9f0113f029f1f2e9bfb0ef4c21cefd..0000000000000000000000000000000000000000 --- a/Assets/SZZ/Dialogue/Self/level1-start.json.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 25d61c961edcbd6409317e7e59f1b6d8 -TextScriptImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/SZZ/Dialogue/Self/max-cheats-reached.ink b/Assets/SZZ/Dialogue/Self/max-cheats-reached.ink index 99a5cf293cbacfc21c5c7db1208525cb36e105d2..2ae7ab9a16d8229e9bd7ad4bd44403a77389e719 100644 --- a/Assets/SZZ/Dialogue/Self/max-cheats-reached.ink +++ b/Assets/SZZ/Dialogue/Self/max-cheats-reached.ink @@ -1,3 +1,3 @@ -DobĹ™e, to by pro teÄŹ mohlo staÄŤit... +[DobĹ™e, to by pro teÄŹ mohlo staÄŤit...] -> END diff --git a/Assets/SZZ/Dialogue/Self/max-cheats-reached.json b/Assets/SZZ/Dialogue/Self/max-cheats-reached.json index ad2178f5100aba7110b8e9d952f735458e9cd699..e50d544c460deaa038e96693bfe7d45b5da2edfa 100644 --- a/Assets/SZZ/Dialogue/Self/max-cheats-reached.json +++ b/Assets/SZZ/Dialogue/Self/max-cheats-reached.json @@ -1 +1 @@ -{"inkVersion":20,"root":[["^DobĹ™e, to by pro teÄŹ mohlo staÄŤit...","\n","end",["done",{"#f":5,"#n":"g-0"}],null],"done",{"#f":1}],"listDefs":{}} \ No newline at end of file +{"inkVersion":20,"root":[["^[DobĹ™e, to by pro teÄŹ mohlo staÄŤit...]","\n","end",["done",{"#f":5,"#n":"g-0"}],null],"done",{"#f":1}],"listDefs":{}} \ No newline at end of file diff --git a/Assets/SZZ/Level/Scenes/building a.unity b/Assets/SZZ/Level/Scenes/building a.unity index d27f7c21ec300fa3eb05cf1d0265d6908ba75746..8d10aebb3868ea03dcfb508778227714b2393ce5 100644 --- a/Assets/SZZ/Level/Scenes/building a.unity +++ b/Assets/SZZ/Level/Scenes/building a.unity @@ -25099,7 +25099,7 @@ Transform: - {fileID: 1788797531} - {fileID: 1893192112} m_Father: {fileID: 0} - m_RootOrder: 4 + m_RootOrder: 6 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1001 &1004904546 PrefabInstance: @@ -45265,7 +45265,7 @@ Transform: - {fileID: 1234824317} - {fileID: 1092490400} m_Father: {fileID: 0} - m_RootOrder: 2 + m_RootOrder: 4 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1001 &1860173879 PrefabInstance: @@ -45590,7 +45590,7 @@ Transform: - {fileID: 1596836417} - {fileID: 593223143} m_Father: {fileID: 0} - m_RootOrder: 1 + m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!4 &1867072812 stripped Transform: @@ -46356,7 +46356,7 @@ Transform: - {fileID: 32797275} - {fileID: 494654910} m_Father: {fileID: 0} - m_RootOrder: 3 + m_RootOrder: 5 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1001 &1899181176 PrefabInstance: @@ -52064,7 +52064,7 @@ Transform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 6 + m_RootOrder: 7 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!4 &543450652047391012 stripped Transform: @@ -53918,7 +53918,7 @@ PrefabInstance: - target: {fileID: 6330820102716056176, guid: 1eb73f1b5311760469cc6e221f2538a9, type: 3} propertyPath: m_RootOrder - value: 5 + value: 1 objectReference: {fileID: 0} - target: {fileID: 6330820102716056176, guid: 1eb73f1b5311760469cc6e221f2538a9, type: 3} @@ -54116,7 +54116,7 @@ PrefabInstance: - target: {fileID: 6909880373530918866, guid: 39967ec940f6f104eabe57a2974f7ab0, type: 3} propertyPath: m_RootOrder - value: 7 + value: 3 objectReference: {fileID: 0} - target: {fileID: 6909880373530918866, guid: 39967ec940f6f104eabe57a2974f7ab0, type: 3} diff --git a/Assets/SZZ/Prefabs/Logic/GameState.prefab b/Assets/SZZ/Prefabs/Logic/GameState.prefab index 761d9c63cf7b1d25a3841f226ef596ef9be07260..1acdfe0a49767594598a182e8f58fe0ca30edff7 100644 --- a/Assets/SZZ/Prefabs/Logic/GameState.prefab +++ b/Assets/SZZ/Prefabs/Logic/GameState.prefab @@ -444,6 +444,7 @@ MonoBehaviour: - {fileID: 21300000, guid: 4709a4ad857b65f488c202f88ac74aa8, type: 3} timer: {fileID: 6330820102687515709} timerLength: 100 + maxCheatsInkJSON: {fileID: 4900000, guid: 17670a8818c57114cabe2ba7e74d52b7, type: 3} --- !u!114 &6330820102716056178 MonoBehaviour: m_ObjectHideFlags: 0 diff --git a/Assets/SZZ/Prefabs/Logic/View.prefab b/Assets/SZZ/Prefabs/Logic/View.prefab index e0976c91b147a827116b9ba94164f70ea8273526..9693c92f8e74c8920c8eaff811c9c0648851befa 100644 --- a/Assets/SZZ/Prefabs/Logic/View.prefab +++ b/Assets/SZZ/Prefabs/Logic/View.prefab @@ -1807,6 +1807,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: a7041f553154ba0409a2c56f6a8c1e28, type: 3} m_Name: m_EditorClassIdentifier: + _player: {fileID: 1722896712072917824} _playerInput: {fileID: 6909880373530918865} _inputActionAsset: {fileID: -944628639613478452, guid: 7a465a0d9e0a168469c9e51761952157, type: 3} @@ -3059,12 +3060,55 @@ PrefabInstance: m_RemovedComponents: - {fileID: 135756641613574976, guid: c5efc39a8aaf6e64ea40e9ad573e9b47, type: 3} m_SourcePrefab: {fileID: 100100000, guid: c5efc39a8aaf6e64ea40e9ad573e9b47, type: 3} +--- !u!114 &1722896712072917824 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 203974826412175163, guid: c5efc39a8aaf6e64ea40e9ad573e9b47, + type: 3} + m_PrefabInstance: {fileID: 1530202875637013627} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7109144527452912175} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4dde85815a4da624ea44a0a174c5c23a, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!4 &3197233019988198259 stripped Transform: m_CorrespondingSourceObject: {fileID: 4135013735270702856, guid: c5efc39a8aaf6e64ea40e9ad573e9b47, type: 3} m_PrefabInstance: {fileID: 1530202875637013627} m_PrefabAsset: {fileID: 0} +--- !u!1 &7109144527452912175 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 8616685848737228372, guid: c5efc39a8aaf6e64ea40e9ad573e9b47, + type: 3} + m_PrefabInstance: {fileID: 1530202875637013627} + m_PrefabAsset: {fileID: 0} +--- !u!114 &8329629129859309969 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7109144527452912175} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 063913b232069524eb0bb1c306582ea0, type: 3} + m_Name: + m_EditorClassIdentifier: + inkJSON: {fileID: 0} + onStart: + m_PersistentCalls: + m_Calls: [] + onChoice: + m_PersistentCalls: + m_Calls: [] + onBreak: + m_PersistentCalls: + m_Calls: [] + onFinish: + m_PersistentCalls: + m_Calls: [] --- !u!4 &7629961867817803925 stripped Transform: m_CorrespondingSourceObject: {fileID: 8997996947095583982, guid: c5efc39a8aaf6e64ea40e9ad573e9b47,