Fix flow to/from battle, add cheat code to win

This commit is contained in:
henriquenakashima 2020-09-28 23:41:27 -04:00
parent 0b295af56b
commit 959458ad74
7 changed files with 58 additions and 16 deletions

View file

@ -12,7 +12,7 @@ public class Scene_Chapter1_Cave: StoryScene
yield return new WaitForSeconds(1f);
BattleParameters battleParameters = BuildBattleGolemBats();
BattleSetup.StartBattle(battleParameters);
this.StartBattleThenNextSceneId(battleParameters, SceneId.Chapter1_Cave);
}
private BattleParameters BuildBattleGolemBats() {

View file

@ -6,26 +6,26 @@ public class Scene_Prologue_First: StoryScene {
public override IEnumerator Play(StoryDisplay storyDisplay) {
storyDisplay.SetBackground("BGNightSky");
yield return new WaitForSeconds(1f);
//yield return new WaitForSeconds(1f);
yield return storyDisplay.DisplayText("Are you going out again?", DialogPosition.Left);
yield return new WaitForSeconds(1f);
//yield return new WaitForSeconds(1f);
yield return storyDisplay.DisplayText("Yes.", DialogPosition.Right);
yield return new WaitForSeconds(1f);
//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 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 new WaitForSeconds(2f);
yield return storyDisplay.DisplayText(
"Finite in time, yes. But infinite in possibilities...",
DialogPosition.Right);
yield return new WaitForSeconds(2f);
//yield return new WaitForSeconds(2f);
this.SetNextSceneId(SceneId.Chapter1_Cave);
}

View file

@ -6,22 +6,30 @@ public class StoryController : MonoBehaviour
{
public StoryDisplay storyDisplay;
private SceneId nextSceneId;
// TODO: Read which scene should be loaded.
private static SceneId sNextSceneId = SceneId.Prologue_First;
void Start() {
// TODO: Read which scene should be loaded.
this.nextSceneId = SceneId.Prologue_First;
StartCoroutine(this.PlayScenes());
}
private IEnumerator PlayScenes() {
while (true) {
SceneId id = this.nextSceneId;
this.nextSceneId = SceneId.None;
// Debug.Log("SceneId id = " + sNextSceneId);
SceneId id = sNextSceneId;
// Debug.Log("sNextSceneId = " + SceneId.None);
sNextSceneId = SceneId.None;
// Debug.Log("StoryScene scene = Load()");
StoryScene scene = StorySceneDatabase.Load(id);
// Debug.Log("yield return scene.Play()");
yield return scene.Play(this.storyDisplay);
this.nextSceneId = scene.GetNextSceneId();
// Debug.Log("sNextSceneId = scene.GetNextSceneId() [" + scene.GetNextSceneId() + "]");
sNextSceneId = scene.GetNextSceneId();
// Debug.Log("if scene.IsBattleNext() [" + scene.IsBattleNext() + "]");
if (scene.IsBattleNext()) {
// Debug.Log("yield break");
yield break;
}
}
}
}

View file

@ -4,12 +4,24 @@ using UnityEngine;
public abstract class StoryScene
{
private bool battleIsNext;
private SceneId nextSceneId = SceneId.None;
public abstract IEnumerator Play(StoryDisplay storyDisplay);
protected void SetNextSceneId(SceneId id) {
this.nextSceneId = id;
this.battleIsNext = false;
}
public void StartBattleThenNextSceneId(BattleParameters battleParameters, SceneId id) {
this.nextSceneId = id;
this.battleIsNext = true;
BattleSetup.StartBattle(battleParameters);
}
public bool IsBattleNext() {
return this.battleIsNext;
}
public SceneId GetNextSceneId() {