public override bool ExecuteAction(GameObject other) { if (!balloonIsActive) { DialogueSystem d = GameObject.FindObjectOfType <DialogueSystem>(); if (d == null) { //Dialogue System is not in the scene Debug.LogWarning("You need a UI in the scene to display dialogue!"); return(false); } //Dialogue System is found b = d.CreateBalloon(textToDisplay, (disappearMode == DisappearMode.ButtonPress), keyToPress, timeToDisappear, backgroundColor, textColor, targetObject); b.BalloonDestroyed += OnBalloonDestroyed; balloonIsActive = true; StartCoroutine(WaitForBallonDestroyed()); return(true); } else { return(false); } }
//private static List<DialogueBalloonAction> balloons = new List<DialogueBalloonAction>(); public BalloonScript CreateBalloon(string dialogueString, bool usingButton, KeyCode button, float timeToDisappear, Color backgroundC, Color textC, Transform targetObj = null) { BalloonScript b = GameObject.Instantiate(balloonPrefab).GetComponent <BalloonScript>(); b.transform.SetParent(transform, false); b.Setup(dialogueString, usingButton, button, timeToDisappear, backgroundC, textC, targetObj); return(b); }
private void OnBalloonDestroyed() { b.BalloonDestroyed -= OnBalloonDestroyed; b = null; balloonIsActive = false; if (followingText != null) { followingText.ExecuteAction(this.gameObject); } }