Example #1
0
        public U Run <U>() where U : Errand <T>, new()
        {
            var errand = ErrandFactory <T> .Get <U>();

            errand.Attach(this, _entities, Game);
            var type = typeof(U);

            _addQueue.Add(ErrandStoreFactory.Get(errand, type));
            return(errand);
        }
Example #2
0
 public void Provision <U>(int num) where U : Errand <T>, new()
 {
     for (var i = 0; i < num; i++)
     {
         _provisionStorage.Add(ErrandFactory <T> .Get <U>());
     }
     for (var i = 0; i < num; i++)
     {
         ErrandFactory <T> .Recycle((U)_provisionStorage[i]);
     }
     if (!_errands.ContainsKey(typeof(U)))
     {
         _errands[typeof(U)] = new List <Errand <T> >();
     }
     _provisionStorage.Clear();
 }