SharpLibEar/Event.cs
author StephaneLenclud
Sun, 24 Jul 2016 20:46:34 +0200
changeset 215 5de8f8eaaa54
parent 210 83dd86e73448
child 229 7c631055b94b
permissions -rw-r--r--
Removing obsolete CEC options.
     1 //
     2 
     3 
     4 using System;
     5 using System.Collections.Generic;
     6 using System.Runtime.Serialization;
     7 
     8 namespace SharpLib.Ear
     9 {
    10     [DataContract]
    11     public abstract class MEvent
    12     {
    13         public string Name { get; protected set; }
    14         public string Description { get; protected set; }
    15 
    16         public abstract void Trigger();
    17     };
    18 
    19     [DataContract]
    20     public abstract class Event : MEvent
    21     {
    22         [DataMember]
    23         public List<Action> Actions = new List<Action>();
    24 
    25         protected Event()
    26         {
    27            
    28         }
    29 
    30         public override void Trigger()
    31         {
    32             Console.WriteLine("Event '" + Name + "' triggered.");
    33             foreach (Action action in Actions)
    34             {
    35                 action.Execute();
    36             }
    37         }
    38     }
    39 
    40 }