예제 #1
0
    void Awake()
    {
        character_array = new GameObject[CHARACTER_CAPACITY];
        sprite_empty.SetActive(false);

        for (int i = 0; i < CHARACTER_CAPACITY; i++)
        {
            character_array[i] = GameObject.Instantiate(sprite_empty);
            character_array[i].transform.parent = dialog_sprite.transform;
        }

        DialogueInstructionElement element = DialogueInstructionElement.Text(statement);
        DialogueInstructionElement wait    = DialogueInstructionElement.Wait(1);
        //active_instruction = new DialogueInstruction(new DialogueInstructionElement[] { wait, element }, true);
    }
예제 #2
0
    private DialogueInstruction TransformInstruction(string instruction)
    {
        List <DialogueInstructionElement> element_list = new List <DialogueInstructionElement>();

        element_list.Add(DialogueInstructionElement.Clear());
        string original_instruction = instruction;

        while (instruction != null && instruction.IndexOf('{') != -1)
        {
            int index = instruction.IndexOf('{');

            if (index > 0)
            {
                string text = instruction.Substring(0, index);
                Debug.Log("Found text bit: " + text);
                element_list.Add(DialogueInstructionElement.Text(text));

                instruction = instruction.Substring(index);
            }

            index = instruction.IndexOf('}');
            if (index == -1)
            {
                throw new System.Exception("Closing character '}' not found in instruction: " + original_instruction);
            }

            element_list.Add(ProcessCommand(instruction.Substring(1, index - 1)));
            instruction = instruction.Length == index + 1 ? null : instruction.Substring(index + 1);
        }

        if (instruction != null)
        {
            element_list.Add(DialogueInstructionElement.Text(instruction));
        }


        return(new DialogueInstruction(element_list.ToArray(), true));
    }