Exemple #1
0
 public static IGameObjectDictionary ForEach(this IGameObjectDictionary gameObj, Action <IUpdateableLite> delegateAction)
 {
     lock (gameObj)
     {
         var keys = new List <string>(gameObj.Keys);
         keys.ForEach(key => delegateAction(gameObj[key]));
         //var enumerator = gameObj.GetEnumerator();
         //while (enumerator.MoveNext())
         //    delegateAction(enumerator.Current.Value);
     }
     return(gameObj);
 }
        //public static void AddTimeBehaviour(this IGameObjectDictionary subject, TimeSpan time,Action action)
        //{
        //    subject.Add($"{Guid.NewGuid().ToString()}_GameTimeTimerBehaviourWrapper",
        //                new UpdateableBehaviourWrapper(new GameTimeTimer(time).Do(action)));
        //}

        public static void AddUpdateable(this IGameObjectDictionary subject, IUpdateableLite updateable)
        {
            subject.Add($"{Guid.NewGuid().ToString()}_UpdateableBehaviourWrapper",
                        new UpdateableBehaviourWrapper(updateable));
        }