public void Raise(T eventArgs) { IGameEventData untypedData = Owner.EventData.Get(_metadata.Id); if (untypedData != null) { var data = (GameEventData <T>)untypedData; data.Raise(Owner, eventArgs); } }
//-------------------------------------------------------------- #region Methods //-------------------------------------------------------------- private GameEventData <T> GetOrCreateLocalData() { IGameEventData untypedData = Owner.EventData.Get(_metadata.Id); GameEventData <T> data; if (untypedData != null) { // data found! data = (GameEventData <T>)untypedData; } else { // No data found! Create new data. data = new GameEventData <T>(); Owner.EventData.Set(_metadata.Id, data); } return(data); }