From 8f2d6036e6eb76bd78baedec9ce1eb6763a980c7 Mon Sep 17 00:00:00 2001 From: doingitraith Date: Sun, 22 Jan 2017 05:46:47 +0100 Subject: [PATCH] Destroy Button --- GGJ17/Assets/Prefab/Dialog/Dialog Left.prefab | Bin 12448 -> 12544 bytes .../Assets/Prefab/Dialog/Dialog Right.prefab | Bin 12448 -> 12544 bytes GGJ17/Assets/Prefab/Dialog/Dialog.prefab | Bin 0 -> 12304 bytes GGJ17/Assets/Prefab/Dialog/Dialog.prefab.meta | 8 +++ GGJ17/Assets/Prefab/UI.prefab | Bin 33128 -> 35112 bytes GGJ17/Assets/Scene/IntroScene.unity | Bin 16472 -> 15552 bytes GGJ17/Assets/Script/Dialog/Dialog.cs | 42 ++++++++------ GGJ17/Assets/Script/Dialog/DialogBox.cs | 3 +- GGJ17/Assets/Script/IntroSequence.cs | 54 ++++++++++++++++++ GGJ17/Assets/Script/IntroSequence.cs.meta | 12 ++++ GGJ17/Assets/Script/ResourceManager.cs | 15 +++-- .../ProjectSettings/EditorBuildSettings.asset | Bin 4212 -> 4212 bytes 12 files changed, 111 insertions(+), 23 deletions(-) create mode 100644 GGJ17/Assets/Prefab/Dialog/Dialog.prefab create mode 100644 GGJ17/Assets/Prefab/Dialog/Dialog.prefab.meta create mode 100644 GGJ17/Assets/Script/IntroSequence.cs create mode 100644 GGJ17/Assets/Script/IntroSequence.cs.meta diff --git a/GGJ17/Assets/Prefab/Dialog/Dialog Left.prefab b/GGJ17/Assets/Prefab/Dialog/Dialog Left.prefab index 4b76e0b9f642015db3f71413469da1b874eb102a..bb981bc3742492b5ed5b1dd1bea95285d090fde3 100644 GIT binary patch delta 172 zcmZ3G*pMW^z@Xv6z+lJ#1cE?z!bSmJ4zcH_E}XSEf62y0a^8*;RmrU~Kv`Xe&8N8B zm;^nT85%Tz{Qp280n#=(kw=(Oa&jD-IHT0$ULJ8q>B)8M`Ya`>6(yVJaK%ec{-avJ z=&?Cht)FqSgr>}70S%tb8X65u0;?8WwLNk;*&bvF14D!TgohmzPqxY07rc%!2kdN diff --git a/GGJ17/Assets/Prefab/Dialog/Dialog Right.prefab b/GGJ17/Assets/Prefab/Dialog/Dialog Right.prefab index 2842db9d768ed92254656ba9bad6362f7483d151..84016b42093570579e61895a24c0f9cdf0cb79c9 100644 GIT binary patch delta 186 zcmZ3G*pMW^z@Xv6z+lJ#1cE?z!bSmp8L{W5E}XSEf62y0a^8*;RmrU~Kv`Xe&8LOj zm{dKO85%Tz{Qp280n*mMz`)4B#0WH^0fa%~l9M0EiZe=0?h_Gbl%8D2uFq1ET2Zoj zo?I;Zp{6c9v|n-C&FLauorKH+e4l6&Chp7h+4NT`)d z$7ijb>68iKdE8te3^Se1 zG>6&T-S6!AcK5gY{q}_rlWZZTjuJwgB*dgVe#ML_Gp0=Km?jSP_xBse19-0#fBO5c z7&CIx!Ap01^nCNkX_NC8wVes{RfH0ReI+74Q;0l1=|>VVAq@Qcd8x=hY>0drAR`Ej z3Go#K=I8fDp6^SKe5AZU{Ux{zXO)kY#CYB(+($D{;ApbDYhkC9;n)RfKRQ~c zuOOb_H*tRUPci6tqyZVqtkA8*eTPqovi3uR*-CU&1|m2al4YH zYh^uTsJAm#LmeVX(@V=p^phM|oo>tZ`l6`tOt;hWM7RHrpNd{H(_;x|#Y!vXHCr7P z_)`{mo2@RV*J_{Vbagvfl$n!dv2;~oW^o+vQnSlyk{<(T$f#uxt|2tD&`^WhvJ7OIIg}ws@Ia-Ia7mkP>Asr5W>2T;+I6x`HY=pe7>D0najORQ{Oo>2MUT9H4ekbT}HPQ`7^V z4oBf-q8bCQ7HPJZLE%aWy1jHb8jrS@4oBh2fiFUuHlV}dL&r|XwH@-sp&XeceX%7Sn&I zw|IYtdNag3;Gu3g=BYO!s?e7uVk<`IETlLNIHscbY@~=&Z&7>>QpBmZD1Hf2#FgI2 zk8)xE1Tb<-y%i~!dW-Vta;di{uFIv~6t4J_NReOatq4E$7Uj|W)LRtS{M4J~=Ys57 zq^M`=tp)*hi}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ocoZEdYOPAMAZQPvkGv{KQX`+ z&o7ZC&)ESUujix!T=Se0;ELxrNR#Iq0Uqa}{i5~MJW~Q(@jQ<-c{qPX^J}|JEx%6?{(>}l&JXZ-eWn%QnrFI?!#R7w{|q{c^_RT)`>$Llb}g&PrqYhvX!9D!jW5cxnN#rSr34vcdSHS}sI)dcr+R&M6bKfUQHI3UCPv*GEV{(XZn3m>rzdjCKFWdGQIH&>QE0IUgVj)r?bJn+TzPb*752euJu zdVO-Tjqe>i;Wc_F#y3>VOyEc2$@M>I)bW|CM$mD{cJ1$bh*4Qju{PN@uI|qDTPGgK zCr*5>cNZH3XMOXHZ*2bU`8D~*3nqT6a_j_!c8}RQ{JWz@*YCLg@rM%0r$42Ugjn>+ z%G=hwxU=#0cTe5ieddaV3dIZ7XE2ZMqr>Ib{Y~5Q(e_|m+lz5+PsVj$(N46rzfzL+ zY{Q{>XD5yoiadjA;h&N$1flLvsR|Bkgh)dAs{WEpxqF|NlT<0BB{(yXN~ z=UH8YZf~)6YrB(I_Y7`}6O9l0p{=*Y@ZF;Nx zh;}R1PVK8eGvHx8v`;I18MR-r{?Ps{{@t^+Y8))66XFyE^(Zav#5;!kT-|>Cp1+4H iFPcvXluH5{lpepu_@ns_75@+2AW+o+ literal 0 HcmV?d00001 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 00a24d39efa12a7c83a7cb5b7a33d13f9ece0f84..f54752652d98925e7ceff9ebf547484c5c4f8fbb 100644 GIT binary patch del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YyInj?g;{ zrCK0C(qaJ(_?mg$e94c3rDY=`((Ex+E|kRj4?fz76U|_tr<0^PLJi^ zjoR=3a^Q+WWzp zy>qXIJIpD(#C$@~@+;ct|{ATzl`%;aSumPzy9w@y#D zPif^OdB48&+USi$Jis<CI|jh;vw_X*4iXi0X);ZncGWrLIS#G>&TTaT2tgt R4$9hLG4ZrAJ^$UR{}*uc)C2$k 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 7c79f91e2ffd99318e812489ea8d8ecda6de797c..be54585b765b45d3be2f06b37027173dd359a4cb 100644 GIT binary patch delta 15 WcmeyO@I_&Rj=