top of page
Environment_LivingRoom_Blured (1).JPG

Narrative-driven interactive choice game 互动选择游戏​

The year is 2050. You are a spy hired to find the defective AI hiding within a seemingly normal family.

今年是2050年。你是一名间谍,任务是找到隐藏在一个看似普通家庭中的AI伪人。

Primary Role(s): Programmer, producer

​主要贡献:编程、负责人

Family

I wrote a dialogue manager that manages the dialogue system for a Unity-based game. It handles displaying dialogue, managing dialogue UI elements, and providing functionality for dialogue responses and progression.

Features:  

- Singleton design pattern to ensure a single instance

- Letter-by-letter text display for dialogue

- Dynamic generation of response buttons

- Support for multiple characters and sprites and branching dialogue

- UI state management (enable/disable other UI elements during dialogue)

Screenshot 2025-01-02 152929.png

Dynamically generating response buttons snippet:

        //destroy previous buttons

        foreach (Transform child in responseButtonContainer.GetComponent<Transform>())
        {Destroy(child.gameObject);}
       
//generate new buttons    
        foreach (DialogueResponse response in node.responses)
        {
                GameObject buttonObj = Instantiate(responseButtonPrefab, responseButtonContainer.GetComponent<Transform>());
                buttonObj.GetComponentInChildren<TextMeshProUGUI>().text = response.responseText;

                buttonObj.GetComponent<Button>().onClick.AddListener(() =>

DialogueManager.Instance.StartDialogue(response.Dialogue.RootNode));

        }
        responseButtonContainer.SetActive(false);

Letter-by-letter display snippet:

    //shows dialogue letter-by-letter

    public async void PrintWord(string dialogue) {

        responseDone = false;

        DialogBodyText.text = "";

        foreach(char letter in dialogue)

        {

            DialogBodyText.text += letter;

            await Task.Delay(50);

        }

        DialogBodyText.text = dialogue;

        if (dialogueCounter == dialogueList.Count) {

            responseButtonContainer.SetActive(true);

        }

        responseDone = true;

    }

©2025 by Annabel Luo.

bottom of page