Ejemplo n.º 1
0
    private void Update()
    {
        if (_dialogue == null)
        {
            return;
        }


        if (!Input.GetButtonDown("Jump") || pause)
        {
            return;
        }
        if (_currentLine >= _dialogue.Length)
        {
            if (!finalDialogue)
            {
                StartCoroutine(TransparentSprite());
            }
            Debug.Log("ending dialogue");
            if (GameObject.Find("ReturnToMap") != null)
            {
                GameObject.Find("ReturnToMap").GetComponent <ReturnToMap>().inDialogue = false;
            }


            TextCanvas.DOFade(0, OpeningAnimationDuration);

            GameLogic.Instance.dialogueActive = false;
            LeftCharacterImage.ToggleCharacter(OpeningAnimationDuration);
            RightCharacterImage.ToggleCharacter(OpeningAnimationDuration);

            // Actualize Game State
            if (_do.fireIndex)
            {
                GameLogic.Instance.IncreaseDialogueIndex();
            }

            if (_do.fireState)
            {
                GameLogic.Instance.NextGameState();
            }

            _do       = null;
            _dialogue = null;
            finished  = true;
        }
        else
        {
            PlayNextLine();
        }
    }
Ejemplo n.º 2
0
    //public void StartDialogue(string characterA, string characterB, string[] dialogue)
    public void StartDialogue(DialogueObject diag)
    {
        if (GameObject.Find("ReturnToMap") != null)
        {
            GameObject.Find("ReturnToMap").GetComponent <ReturnToMap>().inDialogue = true;
        }

        Debug.Log("Starting dialogue");
        finished        = false;
        _do             = diag;
        _dialogue       = diag.diaglogue;
        _characterAName = diag.PersonA == "You" ? GameLogic.Instance.playerName : diag.PersonA;
        _characterBName = diag.PersonB == "You" ? GameLogic.Instance.playerName : diag.PersonB;
        RightCharacterImage._image.sprite = diag.PersonAImage == null ? GameLogic.Instance.playerSprite : diag.PersonAImage;        // sorry luca
        LeftCharacterImage._image.sprite  = diag.PersonBImage == null ? GameLogic.Instance.playerSprite : diag.PersonBImage;        // sorry luca
        LeftCharacterImage.ToggleCharacter(OpeningAnimationDuration, GetPortraitForCharacter(diag.PersonA));
        RightCharacterImage.ToggleCharacter(OpeningAnimationDuration, GetPortraitForCharacter(diag.PersonB));

        TextCanvas.DOFade(1, OpeningAnimationDuration);

        _currentLine        = 0;
        _characterASpeaking = true;
        PlayNextLine();
    }