public IEnumerator FadeOutCharacter(VisualNovelCharacterUI portrait, float tweenLength = 1.0f)
    {
        float counter = 0;

        while (counter < tweenLength)
        {
            counter += UI.deltaTime;
            portrait.spriteRenderer.color = Color.Lerp(portrait.spriteRenderer.color, Color.white * 0.7f, counter / tweenLength);
            yield return(new WaitForSeconds(0.01f));
        }
        yield return(null);
    }
    public IEnumerator TweenOutCharacter(VisualNovelCharacterUI portrait, Vector3 FromPosition, Vector3 ToPosition, float tweenLength = 1.0f)
    {
        portrait.inScene = false;
        float counter = 0;

        portrait.transform.position = FromPosition;
        while (counter < tweenLength)
        {
            counter += UI.deltaTime;
            portrait.spriteRenderer.color = Color.Lerp(Color.white, Color.clear, counter / tweenLength);
            portrait.transform.position   = Vector3.Lerp(FromPosition, ToPosition, counter / tweenLength);
            yield return(null);
        }
        yield return(null);
    }
Esempio n. 3
0
    //Janky library functions
    public IEnumerator TweenInCharacter(VisualNovelCharacterUI portrait, Vector3 FromPosition, Vector3 ToPosition, float tweenLength = 1.0f)
    {
        float counter = 0;

        portrait.transform.position = FromPosition;
        while (counter < tweenLength)
        {
            counter += DialogueUIController.deltaTime;
            portrait.spriteRenderer.color = Color.Lerp(Color.clear, Color.white, counter / tweenLength);
            portrait.transform.position   = Vector3.Lerp(FromPosition, ToPosition, counter / tweenLength);
            yield return(null);
        }
        portrait.inScene = true;
        yield return(null);
    }
    public void Exit(string characterName, Direction dir)
    {
        VisualNovelCharacterUI portrait = loadedCharacters.Find(x => x.characterName == characterName);

        if (dir == Direction.Left)
        {
            portrait.side = VisualNovelCharacterUI.StageSide.Left;
        }
        if (dir == Direction.Right)
        {
            portrait.side = VisualNovelCharacterUI.StageSide.Right;
        }

        if (dir == Direction.Left)
        {
            StartCoroutine(TweenOutCharacter(portrait, leftPosition.transform.position, leftWingPosition.transform.position));
        }
        if (dir == Direction.Right)
        {
            StartCoroutine(TweenOutCharacter(portrait, rightPosition.transform.position, rightWingPosition.transform.position));
        }
    }
    internal void ChangeSprite(string characterName, int spriteIdx)
    {
        VisualNovelCharacterUI portrait = loadedCharacters.Find(x => x.characterName == characterName);

        portrait.spriteRenderer.sprite = portrait.Sprites[spriteIdx];
    }
 private void SendBackward(VisualNovelCharacterUI portrait)
 {
     StartCoroutine(FadeOutCharacter(portrait, 0.5f));
 }
 private void SendForward(VisualNovelCharacterUI portrait)
 {
     StartCoroutine(FadeInCharacter(portrait, 0.5f));
 }