StephaneLenclud@210: // StephaneLenclud@210: StephaneLenclud@210: StephaneLenclud@210: using System; StephaneLenclud@210: using System.Collections.Generic; StephaneLenclud@210: using System.Runtime.Serialization; StephaneLenclud@210: StephaneLenclud@210: namespace SharpLib.Ear StephaneLenclud@210: { StephaneLenclud@210: [DataContract] StephaneLenclud@210: public abstract class MEvent StephaneLenclud@210: { StephaneLenclud@210: public string Name { get; protected set; } StephaneLenclud@210: public string Description { get; protected set; } StephaneLenclud@210: StephaneLenclud@210: public abstract void Trigger(); StephaneLenclud@210: }; StephaneLenclud@210: StephaneLenclud@210: [DataContract] StephaneLenclud@210: public abstract class Event : MEvent StephaneLenclud@210: { Stephane@212: [DataMember] Stephane@212: public List Actions = new List(); StephaneLenclud@210: StephaneLenclud@210: protected Event() StephaneLenclud@210: { Stephane@212: StephaneLenclud@210: } StephaneLenclud@210: StephaneLenclud@210: public override void Trigger() StephaneLenclud@210: { StephaneLenclud@210: Console.WriteLine("Event '" + Name + "' triggered."); StephaneLenclud@210: foreach (Action action in Actions) StephaneLenclud@210: { StephaneLenclud@210: action.Execute(); StephaneLenclud@210: } StephaneLenclud@210: } StephaneLenclud@210: } StephaneLenclud@210: StephaneLenclud@210: }