diff --git a/GGJ17/Assets/Prefab/Dialog/Dialog Left.prefab b/GGJ17/Assets/Prefab/Dialog/Dialog Left.prefab index 4b76e0b..bb981bc 100644 Binary files a/GGJ17/Assets/Prefab/Dialog/Dialog Left.prefab and b/GGJ17/Assets/Prefab/Dialog/Dialog Left.prefab differ diff --git a/GGJ17/Assets/Prefab/Dialog/Dialog Right.prefab b/GGJ17/Assets/Prefab/Dialog/Dialog Right.prefab index 2842db9..84016b4 100644 Binary files a/GGJ17/Assets/Prefab/Dialog/Dialog Right.prefab and b/GGJ17/Assets/Prefab/Dialog/Dialog Right.prefab differ diff --git a/GGJ17/Assets/Prefab/Dialog/Dialog.prefab b/GGJ17/Assets/Prefab/Dialog/Dialog.prefab new file mode 100644 index 0000000..0cc49eb Binary files /dev/null and b/GGJ17/Assets/Prefab/Dialog/Dialog.prefab differ diff --git a/GGJ17/Assets/Prefab/Dialog/Dialog.prefab.meta b/GGJ17/Assets/Prefab/Dialog/Dialog.prefab.meta new file mode 100644 index 0000000..30fb4f6 --- /dev/null +++ b/GGJ17/Assets/Prefab/Dialog/Dialog.prefab.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a8148190d06b1484bac1b82675ada2e2 +timeCreated: 1485045754 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/GGJ17/Assets/Prefab/UI.prefab b/GGJ17/Assets/Prefab/UI.prefab index 00a24d3..f547526 100644 Binary files a/GGJ17/Assets/Prefab/UI.prefab and b/GGJ17/Assets/Prefab/UI.prefab differ diff --git a/GGJ17/Assets/Scene/IntroScene.unity b/GGJ17/Assets/Scene/IntroScene.unity index f74d6c4..ac47402 100644 Binary files a/GGJ17/Assets/Scene/IntroScene.unity and b/GGJ17/Assets/Scene/IntroScene.unity differ diff --git a/GGJ17/Assets/Script/Dialog/Dialog.cs b/GGJ17/Assets/Script/Dialog/Dialog.cs index 1c22319..acd8646 100644 --- a/GGJ17/Assets/Script/Dialog/Dialog.cs +++ b/GGJ17/Assets/Script/Dialog/Dialog.cs @@ -1,17 +1,25 @@ -using System.Collections; +using System; +using System.Collections; using System.Collections.Generic; using UnityEngine; public class Dialog : MonoBehaviour { - public List speeches; - public GameObject dialogLeft, dialogRight; + public List dialogBoxes; + + public struct DialogElement + { + public GameObject dialogBox; + public string text; + } + + public List speeches; // Use this for initialization void Start() { - IEnumerator t = Talk(); - StartCoroutine(t); + //IEnumerator t = Talk(); + //StartCoroutine(t); } // Update is called once per frame @@ -23,20 +31,15 @@ public IEnumerator Talk() { for(int i = 0; i < speeches.Count; ++i) { - GameObject box = null; - if(i%2 == 0) - { - box = Instantiate(dialogLeft); - } - else + GameObject box = Instantiate(speeches[i].dialogBox); + Canvas canvas = FindObjectOfType(); + + if(canvas == null) { - box = Instantiate(dialogRight); + throw new System.Exception("No Canvas in the Scene"); } - Canvas canvas = FindObjectOfType(); - box.transform.parent = canvas.transform; - RectTransform rect = box.GetComponent(); rect.anchoredPosition = new Vector3(rect.rect.width / 2 + 17, @@ -46,7 +49,9 @@ public IEnumerator Talk() new Vector3(rect.anchoredPosition.x, -rect.rect.height / 2 - (i * rect.rect.height) - 14))); - yield return StartCoroutine(box.GetComponent().Speak(speeches[i])); + DialogBox d = box.GetComponent(); + d.text = speeches[i].text; + yield return StartCoroutine(d.Speak()); } } @@ -57,6 +62,11 @@ public IEnumerator MoveDialogBox(RectTransform rect, Vector3 target) rect.anchoredPosition += Vector2.up * 1000 * Time.deltaTime; yield return null; } + } + + internal void Clear() + { + speeches.Clear(); } diff --git a/GGJ17/Assets/Script/Dialog/DialogBox.cs b/GGJ17/Assets/Script/Dialog/DialogBox.cs index 1a4c40d..1f900bd 100644 --- a/GGJ17/Assets/Script/Dialog/DialogBox.cs +++ b/GGJ17/Assets/Script/Dialog/DialogBox.cs @@ -6,6 +6,7 @@ public class DialogBox : MonoBehaviour { private Text textbox; + public string text; // Use this for initialization void Start() @@ -19,7 +20,7 @@ void Update() } - public IEnumerator Speak(string text) + public IEnumerator Speak() { int i = 0; textbox.text = ""; diff --git a/GGJ17/Assets/Script/IntroSequence.cs b/GGJ17/Assets/Script/IntroSequence.cs new file mode 100644 index 0000000..b2bf181 --- /dev/null +++ b/GGJ17/Assets/Script/IntroSequence.cs @@ -0,0 +1,54 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class IntroSequence : MonoBehaviour +{ + + public GameObject dialog; + private Dialog d; + // Use this for initialization + void Start() + { + d = dialog.GetComponent(); + StartCoroutine(PlayIntro()); + } + + // Update is called once per frame + void Update() + { + + } + + public IEnumerator PlayIntro() + { + d.speeches = new List(); + + Dialog.DialogElement e = new Dialog.DialogElement(); + e.dialogBox = d.dialogBoxes[0]; + e.text = "Waverider, please come in. This is Mission Control."; + d.speeches.Add(e); + + e = new Dialog.DialogElement(); + e.dialogBox = d.dialogBoxes[1]; + e.text = "Mission Control, this is the Waverider! What are your orders?"; + d.speeches.Add(e); + + e = new Dialog.DialogElement(); + e.dialogBox = d.dialogBoxes[0]; + e.text = "We have an important mission for you. You have to travel to a near solar system where you will find the planet of Psion. Our research team has located a powerful new energy source below the planet's surface."; + d.speeches.Add(e); + + e = new Dialog.DialogElement(); + e.dialogBox = d.dialogBoxes[0]; + e.text = "Your mission will be to retrieve a probe from this new energy form and bring it back to Earth! This is a mission of the highest priority. I am sending the coordinates to your computer as we speak. Good luck Waverider!"; + d.speeches.Add(e); + + e = new Dialog.DialogElement(); + e.dialogBox = d.dialogBoxes[1]; + e.text = "Roger mission control! We will not let you down! Over."; + d.speeches.Add(e); + + yield return StartCoroutine(d.Talk()); + } +} diff --git a/GGJ17/Assets/Script/IntroSequence.cs.meta b/GGJ17/Assets/Script/IntroSequence.cs.meta new file mode 100644 index 0000000..a03ad7e --- /dev/null +++ b/GGJ17/Assets/Script/IntroSequence.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 2e4775103989c5b4c994b9064a99c0ae +timeCreated: 1485053665 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/GGJ17/Assets/Script/ResourceManager.cs b/GGJ17/Assets/Script/ResourceManager.cs index c8d30f2..932242c 100644 --- a/GGJ17/Assets/Script/ResourceManager.cs +++ b/GGJ17/Assets/Script/ResourceManager.cs @@ -2,16 +2,18 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; +using UnityEngine.UI; public class ResourceManager : MonoBehaviour { - public float ousaResource, ousaDelta, timeWait; + public float ousiaResource, ousiaDelta, timeWait; + public Text resourceText; // Use this for initialization void Start() { - ousaResource = 0f; - ousaDelta = 0f; + ousiaResource = 0f; + ousiaDelta = 0f; timeWait = 0f; } @@ -30,16 +32,17 @@ void Update() private void updateResources() { - ousaResource += ousaDelta; + ousiaResource += ousiaDelta; + resourceText.text = ousiaResource.ToString(); } public void RegisterResources(float resource_value) { - ousaDelta += resource_value; + ousiaDelta += resource_value; } public void DeregisterResources(float resource_value) { - ousaDelta -= resource_value; + ousiaDelta -= resource_value; } } diff --git a/GGJ17/ProjectSettings/EditorBuildSettings.asset b/GGJ17/ProjectSettings/EditorBuildSettings.asset index 7c79f91..be54585 100644 Binary files a/GGJ17/ProjectSettings/EditorBuildSettings.asset and b/GGJ17/ProjectSettings/EditorBuildSettings.asset differ