public virtual void FireEvent(object sender, HappeningArgs args) { foreach (Component c in Components) { if (args.requires == c.typeOfComponent) { c.Execute(sender, args); } } }
private void OnTerrainChange(object sender, HappeningArgs e) { if (e.requires == TypeOfComponent.PHYSIC) { WaterIsStatic = false; for (int x = 0; x < Width; x++) { for (int y = 0; y < Height; y++) { WaterGridNeedUpdate[x, y] = true; } } } }
private void RecieveTextFromGame(object sender, HappeningArgs happening) { LowerTextDisplay.WriteLine(happening.text, Color.Blue); }
public virtual void Execute(object sender, HappeningArgs args) { }
public override void FireEvent(object sender, HappeningArgs args) { base.FireEvent(sender, args); }
public override void Execute(object sender, HappeningArgs args) { base.Execute(sender, args); }
public event HappeningEventHandler HappeningEvent; //2.declare event public void RaiseHappeningEvent(HappeningArgs args) // 3.method to raise event { HappeningEvent?.Invoke(this, args); }