internal void Update() { OnUpdateEventHandler handler = OnUpdate; handler?.Invoke(); ModLiquidManager.RunInLiquidEvent(GetRectangle, InLiquid); }
protected virtual void OnUpdate() { // Make a temporary copy of the event to avoid possibility of // a race condition if the last subscriber unsubscribes // immediately after the null check and before the event is raised. OnUpdateEventHandler handler = EventUpdate; EventArgs e = new EventArgs(); // Event will be null if there are no subscribers if (handler != null) { // Format the string to send inside the EventArgs parameter //e.Message += String.Format(" at {0}", DateTime.Now.ToString()); // Use the () operator to raise the event. handler(this, e); } }