Ejemplo n.º 1
0
        public virtual void SetCharacter(Character character, Flowchart flowchart = null)
        {
            if (character == null)
            {
                if (characterImage != null)
                {
                    characterImage.gameObject.SetActive(false);
                }
                if (nameText != null)
                {
                    nameText.text = "";
                }
                characterTypingSound = null;
            }
            else
            {
                Character prevSpeakingCharacter = speakingCharacter;
                speakingCharacter = character;

                // Dim portraits of non-speaking characters
                foreach (Stage s in Stage.activeStages)
                {
                    if (s.dimPortraits)
                    {
                        foreach (Character c in s.charactersOnStage)
                        {
                            if (prevSpeakingCharacter != speakingCharacter)
                            {
                                if (c != speakingCharacter)
                                {
                                    Portrait.Dim(c, s);
                                }
                                else
                                {
                                    Portrait.Undim(c, s);
                                }
                            }
                        }
                    }
                }

                string characterName = character.nameText;

                if (characterName == "")
                {
                    // Use game object name as default
                    characterName = character.name;
                }

                if (flowchart != null)
                {
                    characterName = flowchart.SubstituteVariables(characterName);
                }

                characterTypingSound = character.soundEffect;

                SetCharacterName(characterName, character.nameColor);
            }
        }
Ejemplo n.º 2
0
        public virtual void SetCharacter(Character character, FungusScript fungusScript = null)
        {
            if (character == null)
            {
                if (characterImage != null)
                {
                    characterImage.enabled = false;
                }
                if (nameText != null)
                {
                    nameText.text = "";
                }
                characterTypingSound = null;
            }
            else
            {
                Character prevSpeakingCharacter = speakingCharacter;
                speakingCharacter = character;

                // Dim portraits of non-speaking characters
                foreach (PortraitStage ps in PortraitStage.activePortraitStages)
                {
                    if (ps.dimPortraits)
                    {
                        foreach (Character c in ps.charactersOnStage)
                        {
                            if (prevSpeakingCharacter != speakingCharacter)
                            {
                                if (c != speakingCharacter)
                                {
                                    Portrait.Dim(c, ps);
                                }
                                else
                                {
                                    Portrait.Undim(c, ps);
                                }
                            }
                        }
                    }
                }

                string characterName = character.nameText;
                if (characterName == "")
                {
                    // Use game object name as default
                    characterName = character.name;
                }

                if (fungusScript != null)
                {
                    characterName = fungusScript.SubstituteVariables(characterName);
                }

                characterTypingSound = character.soundEffect;

                SetCharacterName(characterName, character.nameColor);
            }
        }