示例#1
0
        private void ShowDialogueStructure(int _index)
        {
            currentStructureIndex = _index;

            // destroy the previous shown element
            if (activeDialogueElement != null)
            {
                DestroyDialogueElement(activeDialogueElement);
            }

            // DANI REFACTORIZA ESTO, NO NOS GUSTAN LOS IFs ----------------------------------------------------------------------------- //
            // Is it a question?
            if (dialogStructures[_index] is SO_QuestionAnswerStructure)
            {
                activeDialogueElement = Instantiate(canvasedDialoguePrefab, dialogueCanvas.transform);
                (activeDialogueElement as CanvasedDialogue).Initialize(dialogStructures[_index] as SO_QuestionAnswerStructure, this, LanguageManager.GetGameLanguage());
            }
            // Is it a speach element?
            else if (dialogStructures[_index] is SO_SpeachStructure)
            {
                activeDialogueElement = Instantiate(canvasedSpeachPrefab, dialogueCanvas.transform);
                (activeDialogueElement as CanvasedSpeach).Initialize(dialogStructures[_index] as SO_SpeachStructure, this, LanguageManager.GetGameLanguage());
            }
            // ---------------------------------------------------------------------------------------------------------------------------- //

            // setup the navigation using the keyboard (default axis)
            dialogueEventSystem.firstSelectedGameObject = null;
            (activeDialogueElement as I_DialogElement).InitializeDefaultKeyboardNavigation(dialogueEventSystem);

            Debug.LogWarning("showing as active the object " + dialogueEventSystem.firstSelectedGameObject.GetType());
        }
示例#2
0
 private void DestroyDialogueElement(CanvasedDialogElement _target)
 {
     Destroy(_target.gameObject);
 }