void Trigger(GameEventArgs eventArgs) { ExampleArgs args = eventArgs as ExampleArgs; //do something with args print(args.someInt); }
protected virtual void OnChanged(ExampleArgs e) { if (StatusUpdate != null) { StatusUpdate(this, e); } }
void OnGUI() { GUILayout.BeginArea(new Rect(0, 0, Screen.width, Screen.height)); // A button, to force a reload of the same level. if (GUILayout.Button("load count: " + loadCount + ". Reload level")) { var args = new ExampleArgs(); args.loadCount = loadCount + 1; // Our audio survives the level change Audio.PlayClip(clip); LoadLevelArgs.LoadLevel(Application.loadedLevelName, args); } if (GUILayout.Button("force game over")) { LoadLevelArgs.LoadLevel("GameOver", "Game over!!\n\nloadcount: " + loadCount); } GUILayout.EndArea(); }
void ExampleB_StatusUpdate(object sender, ExampleArgs e) { UpdateUI(); }
void ExampleC_StatusUpdate(object sender, ExampleArgs e) { OnChanged(e); }