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

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