예제 #1
0
 void Awake()
 {
     if (instance)
     {
         DestroyImmediate(gameObject);
     }
     else
     {
         DontDestroyOnLoad(gameObject);
         instance = this;
     }
 }
예제 #2
0
        private void Awake()
        {
            _dialogueUI = FindObjectOfType <DialogueUI>();

            _background       = GetComponentInParent <Image>();
            _background.color = Color.clear;

            _animator = GetComponent <Animator>();
            AnimationClip[] animationClips = _animator.runtimeAnimatorController.animationClips;
            _animations = new Dictionary <string, string>()
            {
                ["FadeIn"]  = animationClips[0].name,
                ["FadeOut"] = animationClips[1].name,
            };

            _dialogueUI.onLineFinishDisplaying.AddListener(FadeIn);
            _dialogueUI.onLineStart.AddListener(FadeOut);
            _dialogueUI.onDialogueEnd.AddListener(FadeOut);
        }
예제 #3
0
        private void Awake()
        {
            _dialogueUI = GetComponent <DialogueUI>();
            _dialogueUI.onLineUpdate.AddListener(UpdateText);
            _dialogueUI.onDialogueEnd.AddListener(DefaultCurrentDialogueContainer);

            if (defaultDialogueContainer != null)
            {
                _dialogueUI.dialogueContainer = defaultDialogueContainer.container;
                _currentTextElement           = defaultDialogueContainer.textElement;
            }
            else
            {
                Debug.LogWarning("No default dialogue container set in DialoguePlacer");
            }

            // Disable all dialogueContainer is the scene.
            foreach (DialogueContainer dialogueContainer in FindObjectsOfType <DialogueContainer>())
            {
                dialogueContainer.container.SetActive(false);
            }
        }