示例#1
0
        /// <summary>
        /// Signals that it is time to update logic.
        /// </summary>
        /// <param name="elapsed">The time passed since last frame.</param>
        public void Update(TimeSpan elapsed)
        {
            foreach (string registrant in coordinator.Registrants)
            {
                ReadOnlyCollection <BehaviorGroup> groups = coordinator.Select(registrant);

                for (int i = 0; i < groups.Count; i++)
                {
                    // foreach'ing == trying to remove behavior during run-time == exception
                    for (int j = 0; j < groups[i].Count; j++)
                    {
                        if (groups[i][j].Enabled)
                        {
                            groups[i][j].Update(elapsed);
                        }
                    }
                }
            }
        }