예제 #1
0
    /// <summary>
    /// Assigns the current dialogue speaker.
    /// </summary>
    /// <param name="charIdArg"></param>
    public void AssignSpeaker(string charIdArg)
    {
        // get the new character speaker to set
        CharacterData newSpeaker = GetCharacterInDialogueScene(charIdArg);

        // if new speaker is the same speaker as the current one
        if (newSpeaker == currentSpeaker)
        {
            // DONT continue code
            return;
        }

        // get character portrait of speaking character
        DialogueCharacterPortraitController speakerPortrait = GetCharacterPortraitInScene(charIdArg);

        // if speaking character DOES have their portrait in scene
        if (speakerPortrait != null)
        {
            // play portrait's highlight animation
            speakerPortrait.PlayAnimationHighlight();
        }

        // set the new speaker as the character that is currently speaking
        SetCharSpeaker(newSpeaker);
    }
예제 #2
0
    /// <summary>
    /// Turns off a character portrait to denote it is no longer being used.
    /// </summary>
    /// <param name="charPortraitArg"></param>
    private void DeactivateCharacterPortrait(DialogueCharacterPortraitController charPortraitArg)
    {
        // remove portrait's associated character
        charPortraitArg.SetupCharacterData(null);

        /// deactivate the dialogue portrait to denote character leaving scene and freeing
        /// up a dialogue portrait for use
        charPortraitArg.gameObject.SetActive(false);
    }
예제 #3
0
    /// <summary>
    /// Sets the given character to have the given expression.
    /// </summary>
    /// <param name="charIdArg"></param>
    /// <param name="expressionArg"></param>
    public void SetCharacterPortraitExpression(string charIdArg, CharacterDialogueExpressionType expressionArg)
    {
        // get the given character's associated character portrait
        DialogueCharacterPortraitController charPortrait = GetCharacterPortraitInScene(charIdArg);

        // if portrait found
        if (charPortrait != null)
        {
            // set portrait's expression to given expression
            charPortrait.SetupCharacterExpression(expressionArg);
        }
    }
예제 #4
0
    /// <summary>
    /// Places the associated character portrait in the dialogue scene.
    /// </summary>
    /// <param name="charIdArg"></param>
    public void CharacterPortraitEnterDialogueScene(string charIdArg, CharacterDialogueExpressionType expressionArg)
    {
        // if character portrait is already in scene
        if (IsCharacterPortraitInScene(charIdArg))
        {
            // DONT continue code
            return;
        }

        // get character data for given char ID
        CharacterData charInDialogueScene = GetCharacterInDialogueScene(charIdArg);

        // if char data WAS found
        if (charInDialogueScene != null)
        {
            // get an unused character portrait
            DialogueCharacterPortraitController unusedPort = GetUnusedCharacterPortrait();

            // if an available dialogue portrait was found
            if (unusedPort != null)
            {
                // assign the character data to the dialogue portrait
                unusedPort.SetupCharacterData(charInDialogueScene);
                // asign the character's expression to the dialogue portrait
                unusedPort.SetupCharacterExpression(expressionArg);

                // activate the portrait
                unusedPort.gameObject.SetActive(true);

                /*// set new portrait's position to their appropriate position
                 * unusedPort.transform.position = GetAppropriateDialoguePortraitPosition(
                 *  GetActiveDialoguePortraits().Count, GetDialoguePortaitOrderNumber(charIdArg));*/

                // play appear animation for the dialogue portrait
                unusedPort.PlayAnimationAppear();

                // set the entering character as the character that is currently speaking
                //SetCharSpeaker(charInDialogueScene);
            }
        }

        // moves all active character portraits to their appropriate positions
        RefreshDialoguePortraitPositions();
    }
예제 #5
0
    private IEnumerator CharacterPortraitExitDialogueSceneInternal(string charIdArg)
    {
        // get the char dialogue portrait associated with the given ID
        DialogueCharacterPortraitController charPort = GetCharacterPortraitInScene(charIdArg);

        // if dialogue portrait actually found
        if (charPort != null)
        {
            // play disappear animation for the dialogue portrait
            charPort.PlayAnimationDisappear();

            // wait till sure that animation is done
            yield return(new WaitForSeconds(1f));

            // turn off a character portrait to denote it is no longer being used
            DeactivateCharacterPortrait(charPort);
        }

        // moves all active character portraits to their appropriate positions
        RefreshDialoguePortraitPositions();
    }