Beispiel #1
0
 public static bool IsEmpty(ComponentUpdateResults results)
 {
     lock (padLock)
     {
         return(ReferenceEquals(results, emptyResults));
     }
 }
Beispiel #2
0
        public IEnumerable <ComponentUpdateResults> Update(GameTime gameTime)
        {
            List <ComponentUpdateResults> results = new List <ComponentUpdateResults>();

            for (int i = 0; i < components.Count; i++)
            {
                if (components[i].Destroyed)
                {
                    ComponentRemoved(this, new ComponentRemovedEventArgs(components[i]));
                    components.Remove(components[i]);

                    continue;
                }

                ComponentUpdateResults result = components[i].Update(gameTime, results);

                if (ComponentUpdateResults.IsEmpty(result))
                {
                    continue;
                }

                results.Add(result);
            }

            for (int i = 0; i < results.Count; i++)
            {
                GameObjectComponent component = components.Find(c => results[i].CreatedThis(c));

                if (results[i].BlockNextUpdate)
                {
                    component.SkipUpdate();
                }
            }

            return(results);
        }
Beispiel #3
0
 static ComponentUpdateResults()
 {
     emptyResults = new ComponentUpdateResults();
 }