Exemplo n.º 1
0
        // this is the primary mode of progressing through the game
        // if a Section !hasMenu, then ActivateModule always moves us through to the next SubSection
        private void ActivateModule()
        {
            // set mission name for debug panel
            //debug.UpdateMission(missionName);
            // update the heirarchy for the debug panel display
            //debug.DrawList(currentSectionList, currentSection, currentSubSection, currentModule);

            // Dialogue
            if (currentModule.moduleType == Module.ModuleType.dialogue)
            {
                dialogue.OpenPanel(currentModule, false);
                currentModule.CallEntryEvent();
            }
            // Audio
            else if (currentModule.moduleType == Module.ModuleType.audio)
            {
                audioSystem.PlayAudio(currentModule.audioClip);
                currentModule.CallEntryEvent();
            }
            // Trigger
            else if (currentModule.moduleType == Module.ModuleType.trigger)
            {
                Trigger currentTrigger = currentModule.trigger.GetComponent <Trigger>();
                currentTrigger.Activate();
                currentModule.CallEntryEvent();
            }
            // Activity
            else if (currentModule.moduleType == Module.ModuleType.activity)
            {
                Activity currentActivity = currentModule.activity.GetComponent <Activity>();
                currentActivity.Activate();
                currentModule.CallEntryEvent();
            }
            // Timer
            else if (currentModule.moduleType == Module.ModuleType.timer)
            {
                timer.StartTimer(currentModule.timer);
                currentModule.CallEntryEvent();
                NextModule();
            }
            // Choice
            else if (currentModule.moduleType == Module.ModuleType.choice)
            {
                dialogue.OpenPanel(currentModule, true);
            }
            // Choice
            else if (currentModule.moduleType == Module.ModuleType.menu)
            {
                menu.OpenPanel(currentTaskList, true); // true flag let's the menu know it has been completed (currently a hack)
            }
            // Instructional
            //else if (currentModule.moduleType == Module.ModuleType.instructional)
            //{
            //    if (currentModule.moduleData != null)
            //        instructional.OpenPanel(currentModule.missionActivity, currentModule.moduleData);
            //    else
            //        instructional.OpenPanel(currentModule.missionActivity);
            //}
        }
Exemplo n.º 2
0
        public void OpenPanel(Module _currentModule, bool _hasChoice)
        {
            currentModule = _currentModule;
            hasChoice     = _hasChoice;

            if (hasChoice)
            {
                buttonNext.gameObject.SetActive(false);
                buttonOne.gameObject.SetActive(true);
                buttonTwo.gameObject.SetActive(true);
                //buttonOne.onClick.AddListener(SelectChoiceOne);
                //buttonTwo.onClick.AddListener(SelectChoiceTwo);
            }
            else
            {
                buttonNext.gameObject.SetActive(true);
                buttonOne.gameObject.SetActive(false);
                buttonTwo.gameObject.SetActive(false);
                //buttonOne.onClick.AddListener(ClosePanel);
            }

            if (currentModule.data != null)
            {
                if (currentModule.data.title != null)
                {
                    title.text = currentModule.data.title;
                }
                else
                {
                    title.text = currentModule.moduleName;
                }

                if (currentModule.data.copy != null)
                {
                    copy.text = currentModule.data.copy;
                }
                else
                {
                    copy.text = "Data exists but there is no copy data for this module.";
                }

                if (hasChoice)
                {
                    if (currentModule.data.buttonOneText != null)
                    {
                        buttonOneText.text = currentModule.data.buttonOneText;
                    }
                    else
                    {
                        buttonOneText.text = "Choice 1";
                    }

                    if (currentModule.data.buttonTwoText != null)
                    {
                        buttonTwoText.text = currentModule.data.buttonTwoText;
                    }
                    else
                    {
                        buttonTwoText.text = "Choice 2";
                    }
                }
                else
                {
                    if (currentModule.data.buttonOneText != null)
                    {
                        buttonNextText.text = currentModule.data.buttonOneText;
                    }
                    else
                    {
                        buttonNextText.text = "Next";
                    }
                }

                if (currentModule.data.backgroundImage != null)
                {
                    image.color  = new Color(1, 1, 1, 1);
                    image.sprite = currentModule.data.backgroundImage;
                }
                else
                {
                    image.color = new Color(1, 1, 1, 0);
                }
            }
            else
            {
                title.text = currentModule.moduleName;
                copy.text  = "No data for this module.";
                if (hasChoice)
                {
                    buttonOneText.text = "Choice 1";
                    buttonTwoText.text = "Choice 2";
                }
                else
                {
                    buttonNextText.text = "Next";
                }

                image.color = new Color(1, 1, 1, 0);
            }

            ShowDisplayPanel();


            if (currentModule.audioClip != null)
            {
                //Debug.Log("Dialogue AudioClip !- null");
                buttonOne.interactable = false;
                if (hasChoice)
                {
                    buttonTwo.interactable = false;
                }
                buttonOne.GetComponent <ButtonTextColorChanger>().isActive = false;
                audioSystem.PlayAudio(currentModule.audioClip);
            }
            else
            {
                EnableButton();
            }
        }