Exemple #1
0
    IEnumerator Ready()
    {
        // wait for current encounter to end
        while (GameManager.currentEncounter != null)
        {
            yield return(null);
        }
        yield return(new WaitForSeconds(1));

        ready = true;
        TooltipManager.DisplayInteractNotifier();
        GameManager.pc.EnableAttack = false;
        GameManager.pc.speechBubble.SetBool("on", true);
        // check for player to start dialog
        while (GameManager.currentEncounter == null)
        {
            yield return(null);

            bool inputAttack = Input.GetButtonDown("Attack");
            if (inputAttack)
            {
                ready      = false;
                displaying = true;
                GameManager.pc.EnableMovement = false;
                GameManager.pc.speechBubble.SetBool("on", false);
                TooltipManager.HideInteractNotifier();
                DialogManager.dm.LoadConversation(dialog);
                DialogManager.dm.Activate();
                break;
            }
        }
        if (ready) // if the player started another encounter
        {
            GameManager.pc.EnableAttack = true;
            GameManager.pc.speechBubble.SetBool("on", false);
            TooltipManager.HideInteractNotifier();
        }
        else
        {
            yield return(new WaitForSeconds(0.5f));

            // start dialog
            while (displaying)
            {
                bool inputAttack = Input.GetButtonDown("Attack");
                if (inputAttack)
                {
                    displaying = !DialogManager.dm.Next();
                }
                yield return(null);
            }
            // finish dialog
            yield return(new WaitForSeconds(0.25f));

            GameManager.pc.EnableAttack   = true;
            GameManager.pc.EnableMovement = true;
            DialogManager.dm.Deactivate();
        }
    }
Exemple #2
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.gameObject.layer == Layer.Player && ready)
     {
         clickable = true;
         TooltipManager.DisplayInteractNotifier();
         GameManager.pc.EnableAttack = false;
     }
 }