Add prologue, two story boxes
This commit is contained in:
parent
8119482922
commit
3b9a6f361d
10 changed files with 87 additions and 13 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue