// ---------------------------------------------------------------------- /// <summary> /// Call event. /// </summary> /// <param name="_actionType">Event type</param> /// <param name="_data">Extra info like "screen tag" for example.</param> public static void Call(MinimalPuzzleCallTypes _actionType, object _data = null) { switch (_actionType) { // Toggle audio master volume. case MinimalPuzzleCallTypes.AudioMasterToggle: AudioManager.MasterVolume = (AudioManager.MasterVolume > 0f) ? 0f : 1f; break; // Quit the game. case MinimalPuzzleCallTypes.QuitGame: Application.Quit(); break; // Save the game. case MinimalPuzzleCallTypes.SaveGame: Save(); break; } // Send event to listeners. if (TriggerEvent != null) { TriggerEvent(_actionType, _data); } }
private void OnTriggerEvent(MinimalPuzzleCallTypes _actionType, object _data = null) { switch (_actionType) { case MinimalPuzzleCallTypes.ChangeLevel: FieldCurrentLevel.text = (MinimalPuzzle2D.CurrentLevel).ToString(); break; case MinimalPuzzleCallTypes.NextLevel: MinimalPuzzle2D.CurrentLevel++; break; case MinimalPuzzleCallTypes.PrevLevel: MinimalPuzzle2D.CurrentLevel--; break; } }
private void OnTriggerEvent(MinimalPuzzleCallTypes _actionType, object _data = null) { switch (_actionType) { case MinimalPuzzleCallTypes.ShowScreen: if (ScreenTag == (string)_data) { Show(); } break; case MinimalPuzzleCallTypes.CloseScreen: if (ScreenTag == (string)_data) { Close(); } break; } }