Exemple #1
0
    private void Awake()
    {
        continueButton = dialoguePanel.transform.Find("Continue").GetComponent <Button>();
        dialogueText   = dialoguePanel.transform.Find("Text").GetComponent <Text>();
        nameText       = dialoguePanel.transform.Find("Name").GetChild(0).GetComponent <Text>();
        continueButton.onClick.AddListener(delegate { ContinueDialogue(); });
        dialoguePanel.SetActive(false);


        if (Instance != null && Instance != this)
        {
            Destroy(gameObject);
        }
        else
        {
            Instance = this;
        }
    }
Exemple #2
0
    private void Awake()
    {
        continueBtn = dialoguePanel.transform.Find("Continue").GetComponent <Button>();

        dialogueText = dialoguePanel.transform.Find("DialogueText").GetComponent <Text>();

        nameText = dialoguePanel.transform.Find("Name").GetChild(0).GetComponent <Text>();

        // hide dialogue panel at start
        dialoguePanel.SetActive(false);

        continueBtn.onClick.AddListener(delegate { ContinueDialogue(); });
        // check if the instance is already create destroy on awake if has any then create an instance
        if (Instance != null && Instance != this)
        {
            Destroy(gameObject);
        }
        else
        {
            Instance = this;
        }
    }