Beispiel #1
0
        public void Raise(T eventArgs)
        {
            IGameEventData untypedData = Owner.EventData.Get(_metadata.Id);

            if (untypedData != null)
            {
                var data = (GameEventData <T>)untypedData;
                data.Raise(Owner, eventArgs);
            }
        }
Beispiel #2
0
        //--------------------------------------------------------------
        #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);
        }