Add prologue, two story boxes

This commit is contained in:
henriquenakashima 2020-09-27 22:36:10 -04:00
parent 8119482922
commit 3b9a6f361d
10 changed files with 87 additions and 13 deletions

View file

@ -4,5 +4,6 @@ using UnityEngine;
public enum SceneId
{
Prologue_First,
Chapter1_Cave,
}

View file

@ -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();

View file

@ -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.
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b6318da45a8658d42aef4c5632800eec
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -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;

View file

@ -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));
}

View file

@ -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) {
void Awake() {
Debug.Log("StoryDisplay Awake");
this.storyBoxLeft = GameObject.Instantiate(this.storyBox, this.uiCanvas.transform);
RectTransform rt = this.storyBoxLeft.GetComponent<RectTransform>();
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);
}
}
}

View file

@ -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:

View file

@ -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:

View file

@ -1,3 +1,4 @@
Battle
- Animate rearrange hand after card is used
- Do not Highlight unusable cards
- Show which cards enemies will use
@ -5,3 +6,7 @@
- Extend BattleState to be more than hero turn true/false
- Highlight which card is targeting
- Allow cancelling targeting
Story
- Make dialogue show letter by letter.
- Make dialogue pause at punctuation.