示例#1
0
    void Update()
    {
        // If return key is pressed...
        if (Input.GetKeyUp(KeyCode.Space))
        {
            // open next dialogue
            DialogueManager dialogueManager = GameObject.Find("DialogueManager").GetComponent <DialogueManager> ();
            dialogueManager.DisplayNextSentence();
        }

        if (Input.GetKeyUp(KeyCode.Q))
        {
            // open interaction options
            InteractionsHandler interactionHandler = GameObject.Find("InteractionsHandler").GetComponent <InteractionsHandler>();
            if (interactionHandler.getState())
            {
                string interactionType = interactionHandler.getType();
                string interactionName = interactionHandler.getObjectName();
                if (interactionType == "dialogue")
                {
                    DialogueTrigger trigger = GameObject.Find(interactionName).GetComponent <DialogueTrigger>();
                    trigger.TriggerDialogue();
                }
                else if (interactionType == "")
                {
                    // run associated function
                }
            }
        }
    }