Ejemplo n.º 1
0
        private void ExecuteCommandsForCurrentIndex(List <DialogueCommand> commands, int visibleCharacterIndex, ref float secondsPerCharacter, ref float timeOfLastCharacter)
        {
            for (int i = 0; i < commands.Count; i++)
            {
                DialogueCommand command = commands[i];
                if (command.Position == visibleCharacterIndex)
                {
                    switch (command.Type)
                    {
                    case DialogueCommandType.Pause:
                        timeOfLastCharacter = Time.unscaledTime + command.FloatValue;
                        break;

                    case DialogueCommandType.TextSpeedChange:
                        secondsPerCharacter = 1f / command.FloatValue;
                        break;

                    case DialogueCommandType.Action:
                    case DialogueCommandType.Emotion:
                        EvaluateTag(command);
                        break;
                    }
                    commands.RemoveAt(i);
                    i--;
                }
            }
        }
Ejemplo n.º 2
0
        private static string HandleAnimEndTags(string processedMessage, List <DialogueCommand> result)
        {
            MatchCollection animEndMatches = AnimEndRegex.Matches(processedMessage);

            foreach (Match match in animEndMatches)
            {
                var command = new DialogueCommand
                {
                    Position = VisibleCharactersUpToIndex(processedMessage, match.Index),
                    Type     = DialogueCommandType.AnimEnd,
                };
                result.Add(command);
            }
            processedMessage = Regex.Replace(processedMessage, ANIM_END_REGEX_STRING, "");
            return(processedMessage);
        }
Ejemplo n.º 3
0
        private void EvaluateTag(DialogueCommand command)
        {
            switch (command.Type)
            {
            case DialogueCommandType.Emotion:
                if (onEmotionChange != null)
                {
                    onEmotionChange.RaiseEvent(command.TextEmotionValue);
                }
                break;

            case DialogueCommandType.Action:
                if (onAction != null)
                {
                    onAction.RaiseEvent(command.StringValue);
                }
                break;
            }
        }