Ejemplo n.º 1
0
        //method that starts a new scenario:
        public void ActivateScenario(Scenario scenario)
        {
            if (!scenario || status == ScenarioStatus.success || status == ScenarioStatus.failed) //if there was an active scenario that ended, do not proceed
            {
                return;
            }

            menu.SetActive(false);                                //start by hiding the menu

            if (status == ScenarioStatus.active && this.scenario) //if there was an active scenario already
            {
                CustomEvents.OnScenarioFail(scenario);            //mark scenario as failed

                scenario.GetMission(currMissionID).Disable();     //disable the last active mission in that scenario
            }

            //assign new scenario
            this.scenario = scenario;

            currMissionID = -1;

            menu.SetActive(true);                   //show the scenario menu
            EnableNext();                           //enable the first mission
            status = ScenarioStatus.active;         //this mission scenario is now active

            CustomEvents.OnScenarioStart(scenario); //trigger custom event

            enabled = true;                         //enable this component
        }