// SUBSCRIBING TO EVENTS public void Awake() { SetId(); // Sets this object's id, so we can identify if the events are addressing it or another StoryElement // We set StoryElements to listen for these events ("ENABLE_ELEMENT", "DELETE", etc) and respond with their respective callback methods (OnReceivedEnable, OnDelete, etc) eventsGroup.Add("ENABLE_ELEMENT", OnReceivedEnable); // Triggered when you click the thumbnail and enable the StoryElement eventsGroup.Add("DELETE", OnDelete); // Triggered when you click the delete button in the submenu eventsGroup.Add("BRING_FORWARD", OnBringForward); // Triggered when you click the bring forward button in the submenu eventsGroup.Add("ZOOM_IN", OnZoomIn); // Triggered when you zoom in in the submenu eventsGroup.Add("ZOOM_OUT", OnZoomOut); // Triggered when you zoom out in the submenu eventsGroup.Add("REFLECT", OnReflect); // Triggered when you click reflect in the submenu eventsGroup.StartListening(); gameObject.SetActive(false); }
// Start is called before the first frame update void Start() { Debug.Log("GameManager initialized"); Listeners.Add("SOLARSYSTEM_CLICKED", SolarSystemClicked); Listeners.StartListening("SOLARSYSTEM_CLICKED"); }
private void Start() { listeners.Add(GameConstants.setLevelStatusEvent, LevelStatusSelectionHandler); listeners.StartListening(); SetLevelFromSave(); timeSinceLastClick = clickTolerance * 2; }
void Start() { Listeners.Add("ON_ENEMY_SPAWNED", OnEnemySpawned); Listeners.Add("ON_ENEMY_KILLED", OnEnemyKilled); Listeners.Add("ON_COIN_TAKEN", OnCoinTaken); Listeners.StartListening(); }
// Start is called before the first frame update void Start() { listeners.Add(GameConstants.LevelSelectedEvent, LevelSelectionHandler); listeners.StartListening(); EventManager.EmitEvent(GameConstants.UnpauseGame); CheckForGameComplete(); }
// Start is called before the first frame update void Start() { listeners.Add(GameConstants.MusicVolumeChangeEvent, MusicVolumeChangeHandler); listeners.Add(GameConstants.SfxVolumeChangeEvents, SfxVolumeChangeHandler); listeners.StartListening(); backgroundMusicSource.volume = GlobalStaticVariables.musicVolume; sfxSource.volume = GlobalStaticVariables.sfxVolume; }
// Start is called before the first frame update void Start() { listeners.Add(GameConstants.LoadLevelEvent, LevelSelectionHandler); listeners.Add(GameConstants.UnloadLevelEvent, LevelExitHandler); listeners.Add(GameConstants.OverlapLoadSceneEvent, OverlapLoadHandler); listeners.StartListening(); if (SceneManager.sceneCount <= 1) { loadScene(GameConstants.StartSceneName); } else { SceneManager.SetActiveScene(GetCurrentScene()); } }