Documentation for the Unity C# Library
Loading...
Searching...
No Matches
ScenariosController.cs
Go to the documentation of this file.
1using PixoVR.Audio;
2using PixoVR.Core;
3using UnityEngine;
4
5namespace PixoVR.Event
6{
10 public class ScenariosController : MonoBehaviour
11 {
12 [SerializeField] private ScenariosDataSO scenariosData;
13
14 private Scenario _scenario;
18 private void Start()
19 {
21 }
22
23 private void OnEnable()
24 {
25 EventBetter.Listen(this, (ScenarioSelectedEvent scenarioSelectedEvent) =>
26 {
27 SaveScenario(scenarioSelectedEvent.Scenario);
28 });
29 }
30
31 private void OnDisable()
32 {
33 EventBetter.Unlisten<ScenarioSelectedEvent>(this);
34 }
35
36 public void SaveScenario(Scenario scenario)
37 {
38 _scenario = scenario;
40 StatesService.SaveState(new ScenarioState()
41 {
42 CurrentScenario = _scenario
43 });
44
46
47 StatesService.SaveState(scenarios.StepsDataLink);
48 StatesService.SaveState(scenarios.QuizData);
49 StatesService.SaveState(scenarios.VoiceOverData);
50 }
51
52 public void LoadScenario()
53 {
54 _sceneLoader.LoadScene(SceneType.Scenario);
55 }
56 }
57
58 public class ScenarioSelectedEvent
59 {
60 public Scenario Scenario { get; set; }
61 }
62}
Intentionally made partial, in case you want to extend it easily.
Unity components communication service.
System for transferring state from lobby to scenario.
void SaveScenario(Scenario scenario)
ScenariosDataSO scenariosData
[SerializeField]
ScenarioInfoSO GetScenarioInfo(Scenario scenario)
void LoadScene(SceneType sceneType)
Logic for saving and unloading states during project execution.