diff --git a/Assets/Story/SceneId.cs b/Assets/Story/SceneId.cs index 4f290c6..0b9635b 100644 --- a/Assets/Story/SceneId.cs +++ b/Assets/Story/SceneId.cs @@ -4,5 +4,6 @@ using UnityEngine; public enum SceneId { + Prologue_First, Chapter1_Cave, } diff --git a/Assets/Story/Scenes/Scene_Chapter1_Cave.cs b/Assets/Story/Scenes/Scene_Chapter1_Cave.cs index a8d1329..b78fd72 100644 --- a/Assets/Story/Scenes/Scene_Chapter1_Cave.cs +++ b/Assets/Story/Scenes/Scene_Chapter1_Cave.cs @@ -6,7 +6,7 @@ public class Scene_Chapter1_Cave: StoryScene { public override IEnumerator Play(StoryDisplay storyDisplay) { yield return new WaitForSeconds(1f); - yield return storyDisplay.DisplayText("OMG monsters!"); + yield return storyDisplay.DisplayText("OMG monsters!", DialogPosition.Right); yield return new WaitForSeconds(1f); BattleParameters battleParameters = BuildBattleGolemBats(); diff --git a/Assets/Story/Scenes/Scene_Prologue_First.cs b/Assets/Story/Scenes/Scene_Prologue_First.cs new file mode 100644 index 0000000..9f3ea54 --- /dev/null +++ b/Assets/Story/Scenes/Scene_Prologue_First.cs @@ -0,0 +1,30 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class Scene_Prologue_First: StoryScene { + public override IEnumerator Play(StoryDisplay storyDisplay) { + yield return new WaitForSeconds(1f); + yield return storyDisplay.DisplayText("Are you going out again?", DialogPosition.Left); + yield return new WaitForSeconds(1f); + yield return storyDisplay.DisplayText("Yes.", DialogPosition.Right); + yield return new WaitForSeconds(1f); + yield return storyDisplay.DisplayText( + "Do you not get bored of doing the same things over and over? Seeing the same people, dealing with the same problems?", + DialogPosition.Left); + yield return new WaitForSeconds(1f); + yield return storyDisplay.DisplayText( + "Sometimes I feel like I'm imprisoned in my own life. Like I'm stuck in it, passing the time, until it ends.", + DialogPosition.Left); + yield return storyDisplay.DisplayText( + "Life is finite, after all. There is only so much you can do in it.", + DialogPosition.Left); + yield return new WaitForSeconds(2f); + yield return storyDisplay.DisplayText( + "Finite in time, yes. But infinite in possibilities.", + DialogPosition.Right); + yield return new WaitForSeconds(2f); + + // TODO: Transition to Chapter 1. + } +} diff --git a/Assets/Story/Scenes/Scene_Prologue_First.cs.meta b/Assets/Story/Scenes/Scene_Prologue_First.cs.meta new file mode 100644 index 0000000..f6f04a6 --- /dev/null +++ b/Assets/Story/Scenes/Scene_Prologue_First.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b6318da45a8658d42aef4c5632800eec +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Story/StoryBox.cs b/Assets/Story/StoryBox.cs index 3fb9265..1bfd5fd 100644 --- a/Assets/Story/StoryBox.cs +++ b/Assets/Story/StoryBox.cs @@ -11,15 +11,13 @@ public class StoryBox : MonoBehaviour { private bool clicked; - void Awake() { - this.gameObject.SetActive(false); - } - void Start() { + Debug.Log("StoryBox Start"); this.button.onClick.AddListener(NotifyOnClick); } public IEnumerator Display(string message) { + Debug.Log("StoryBox Display"); this.gameObject.SetActive(true); this.clicked = false; this.text.text = message; diff --git a/Assets/Story/StoryController.cs b/Assets/Story/StoryController.cs index 0f9bd6f..02de8a6 100644 --- a/Assets/Story/StoryController.cs +++ b/Assets/Story/StoryController.cs @@ -10,7 +10,8 @@ public class StoryController : MonoBehaviour void Start() { // TODO: Read which scene should be loaded. - StoryScene scene = StorySceneDatabase.Load(SceneId.Chapter1_Cave); + //StoryScene scene = StorySceneDatabase.Load(SceneId.Chapter1_Cave); + StoryScene scene = StorySceneDatabase.Load(SceneId.Prologue_First); StartCoroutine(scene.Play(this.storyDisplay)); } diff --git a/Assets/Story/StoryDisplay.cs b/Assets/Story/StoryDisplay.cs index f5268e8..3a22113 100644 --- a/Assets/Story/StoryDisplay.cs +++ b/Assets/Story/StoryDisplay.cs @@ -3,11 +3,36 @@ using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; + +public enum DialogPosition { + Left, + Right, +} + public class StoryDisplay : MonoBehaviour { + public Canvas uiCanvas; public StoryBox storyBox; + private StoryBox storyBoxLeft; - public IEnumerator DisplayText(string message) { - yield return this.storyBox.Display(message); + void Awake() { + Debug.Log("StoryDisplay Awake"); + this.storyBoxLeft = GameObject.Instantiate(this.storyBox, this.uiCanvas.transform); + RectTransform rt = this.storyBoxLeft.GetComponent(); + rt.anchorMin = new Vector2(0, 0.5f); + rt.anchorMax = new Vector2(0, 0.5f); + rt.position = new Vector2(+200, rt.position.y); + + this.storyBox.gameObject.SetActive(false); + this.storyBoxLeft.gameObject.SetActive(false); + } + + public IEnumerator DisplayText(string message, DialogPosition position) { + Debug.Log("DisplayText " + message); + if (position == DialogPosition.Left) { + yield return this.storyBoxLeft.Display(message); + } else { + yield return this.storyBox.Display(message); + } } } diff --git a/Assets/Story/StoryScene.unity b/Assets/Story/StoryScene.unity index c6e2349..cdbc056 100644 --- a/Assets/Story/StoryScene.unity +++ b/Assets/Story/StoryScene.unity @@ -332,6 +332,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 79df4d1b57146b7458fa80e709a80e04, type: 3} m_Name: m_EditorClassIdentifier: + uiCanvas: {fileID: 1957655125} storyBox: {fileID: 1465315970} --- !u!4 &948084139 Transform: @@ -573,10 +574,10 @@ RectTransform: m_Father: {fileID: 1957655126} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0.5, y: 0.5} - m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: 199.9, y: -1.2} - m_SizeDelta: {x: 361.20465, y: 414.49365} + m_AnchorMin: {x: 1, y: 0.5} + m_AnchorMax: {x: 1, y: 0.5} + m_AnchoredPosition: {x: -200, y: 0} + m_SizeDelta: {x: 360.6654, y: 414.49365} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1465315970 MonoBehaviour: diff --git a/Assets/Story/StorySceneDatabase.cs b/Assets/Story/StorySceneDatabase.cs index 09db53b..303368b 100644 --- a/Assets/Story/StorySceneDatabase.cs +++ b/Assets/Story/StorySceneDatabase.cs @@ -5,6 +5,8 @@ using UnityEngine; public class StorySceneDatabase { public static StoryScene Load(SceneId id) { switch (id) { + case SceneId.Prologue_First: + return new Scene_Prologue_First(); case SceneId.Chapter1_Cave: return new Scene_Chapter1_Cave(); default: diff --git a/TODO.txt b/TODO.txt index 377aa53..771cd72 100644 --- a/TODO.txt +++ b/TODO.txt @@ -1,7 +1,12 @@ +Battle - Animate rearrange hand after card is used - Do not Highlight unusable cards - Show which cards enemies will use - Show on who enemies will use the cards - Extend BattleState to be more than hero turn true/false - Highlight which card is targeting -- Allow cancelling targeting \ No newline at end of file +- Allow cancelling targeting + +Story +- Make dialogue show letter by letter. +- Make dialogue pause at punctuation. \ No newline at end of file