rjw-quirks/RJW-Quirks/Modules/Quirks/Comps/QuirkComp.cs

33 lines
836 B
C#

using rjwquirks.Modules.Shared.Events;
using System.Collections.Generic;
namespace rjwquirks.Modules.Quirks.Comps
{
public abstract class QuirkComp
{
public QuirkDef parent;
public RjwEventDef eventDef;
/// <summary>
/// Notify quirk comp about the RJW event
/// </summary>
public void NotifyEvent(RjwEvent ev)
{
if (eventDef != null && ev.def == eventDef)
{
HandleEvent(ev);
}
}
/// <summary>
/// Handle an RJW event. This method called only for events of <see cref="eventDef"/>
/// </summary>
protected virtual void HandleEvent(RjwEvent ev) { }
public virtual IEnumerable<string> ConfigErrors(QuirkDef parent)
{
yield break;
}
}
}