Esempio n. 1
0
    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);
        }
    }
Esempio n. 2
0
    //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);
    }
Esempio n. 3
0
    private void OnBalloonDestroyed()
    {
        b.BalloonDestroyed -= OnBalloonDestroyed;
        b = null;
        balloonIsActive = false;

        if (followingText != null)
        {
            followingText.ExecuteAction(this.gameObject);
        }
    }
 void SpawnBalloon()
 {
     _timeSinceLastSpawn = 0.0f;
     _timeToSpawn        = Random.Range(0.0f, 2.0f);
     foreach (Transform b in _balloons)
     {
         BalloonScript bs = b.GetComponent <BalloonScript>();
         if (bs && !bs.isActive)
         {
             bs.Activate();
             break;
         }
     }
 }
    public override bool ExecuteAction(GameObject other)
    {
        if (!balloonIsActive)
        {
            b = GameObject.FindObjectOfType <DialogueSystem>().CreateBalloon(textToDisplay, (disappearMode == DisappearMode.ButtonPress), keyToPress, timeToDisappear, backgroundColor, textColor, targetObject);
            b.BalloonDestroyed += OnBalloonDestroyed;
            balloonIsActive     = true;

            StartCoroutine(WaitForBallonDestroyed());

            // Debug.Log("Returning true");
            return(true);
        }
        else
        {
            return(false);
        }
    }