diff --git a/GGJ17/Assets/Prefab/Dialog/Dialog Left.prefab b/GGJ17/Assets/Prefab/Dialog/Dialog Left.prefab index ac1abdb..4b76e0b 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 74c2f49..2842db9 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/UI.prefab b/GGJ17/Assets/Prefab/UI.prefab index e478b97..603fc7f 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 e4c1e54..f74d6c4 100644 Binary files a/GGJ17/Assets/Scene/IntroScene.unity and b/GGJ17/Assets/Scene/IntroScene.unity differ diff --git a/GGJ17/Assets/Scene/New Scene.unity b/GGJ17/Assets/Scene/New Scene.unity deleted file mode 100644 index 7996b52..0000000 Binary files a/GGJ17/Assets/Scene/New Scene.unity and /dev/null differ diff --git a/GGJ17/Assets/Scene/New Scene.unity.meta b/GGJ17/Assets/Scene/New Scene.unity.meta deleted file mode 100644 index 91b2762..0000000 --- a/GGJ17/Assets/Scene/New Scene.unity.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 66f7c172af30a594caaf11aad4998c69 -timeCreated: 1485018986 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/GGJ17/Assets/Script/Dialog/Dialog.cs b/GGJ17/Assets/Script/Dialog/Dialog.cs index 03c33ba..1c22319 100644 --- a/GGJ17/Assets/Script/Dialog/Dialog.cs +++ b/GGJ17/Assets/Script/Dialog/Dialog.cs @@ -5,10 +5,13 @@ public class Dialog : MonoBehaviour { public List speeches; + public GameObject dialogLeft, dialogRight; // Use this for initialization void Start() { + IEnumerator t = Talk(); + StartCoroutine(t); } // Update is called once per frame @@ -16,15 +19,45 @@ void Update() { } - public IEnumerator talk() + public IEnumerator Talk() { - foreach(string s in speeches) + for(int i = 0; i < speeches.Count; ++i) { - GameObject g = new GameObject(); - g.transform.parent = this.gameObject.transform; - DialogBox d = new DialogBox(); + GameObject box = null; + if(i%2 == 0) + { + box = Instantiate(dialogLeft); + } + else + { + box = Instantiate(dialogRight); + } - yield return new WaitForSeconds(2.0f); + Canvas canvas = FindObjectOfType(); + + box.transform.parent = canvas.transform; + + RectTransform rect = box.GetComponent(); + + rect.anchoredPosition = new Vector3(rect.rect.width / 2 + 17, + -(canvas.pixelRect.height + rect.rect.height / 2)); + + yield return StartCoroutine(MoveDialogBox(rect, + new Vector3(rect.anchoredPosition.x, + -rect.rect.height / 2 - (i * rect.rect.height) - 14))); + + yield return StartCoroutine(box.GetComponent().Speak(speeches[i])); + } + } + + public IEnumerator MoveDialogBox(RectTransform rect, Vector3 target) + { + while(rect.anchoredPosition.y <= target.y) + { + rect.anchoredPosition += Vector2.up * 1000 * Time.deltaTime; + yield return null; } } + + } diff --git a/GGJ17/Assets/Script/Dialog/DialogBox.cs b/GGJ17/Assets/Script/Dialog/DialogBox.cs index 167ec9d..1a4c40d 100644 --- a/GGJ17/Assets/Script/Dialog/DialogBox.cs +++ b/GGJ17/Assets/Script/Dialog/DialogBox.cs @@ -10,7 +10,7 @@ public class DialogBox : MonoBehaviour // Use this for initialization void Start() { - textbox = GetComponent(); + textbox = GetComponentInChildren(); } // Update is called once per frame @@ -28,7 +28,7 @@ public IEnumerator Speak(string text) { textbox.text += text[i]; ++i; - yield return new WaitForSeconds(.5f); + yield return new WaitForSeconds(.07f); } } } diff --git a/GGJ17/Assets/Script/WorldScript.cs b/GGJ17/Assets/Script/WorldScript.cs index cb37a96..f10f483 100644 --- a/GGJ17/Assets/Script/WorldScript.cs +++ b/GGJ17/Assets/Script/WorldScript.cs @@ -12,11 +12,6 @@ public class WorldScript : MonoBehaviour { [HideInInspector] public AbstractBuildingBlock flag; - void Awake() - { - GenerateWorld(); - } - void Start() { Vector3 flagSpawn = blocks[(int)size.x / 2, (int)size.y / 2].transform.position;