/// <summary> /// Because we add objects in the update loop, the current objects we need to load are in ObjectsToAdd /// Iterate through them and call LoadContent on each of them /// </summary> public override void LoadContent() { // Check to see whether we have already called LoadContent CheckShouldLoad(); foreach (T obj in ObjectsToAdd.FindAll(x => x.ShouldLoad)) { // Call load content on all objects which have not already been initialised obj.LoadContent(); } base.LoadContent(); }
/// <summary> /// Because we add objects in the update loop, the current objects we need to load are in ObjectsToAdd. /// Iterate through them, call Initialise on each of them and add to our ActiveObjects /// </summary> public override void Initialise() { // Check to see whether we have already called Initialise CheckShouldInitialise(); foreach (T obj in ObjectsToAdd.FindAll(x => x.ShouldInitialise)) { // Call initialise on all objects which have not already been initialised obj.Initialise(); } ActiveObjects.AddRange(ObjectsToAdd); ObjectsToAdd.Clear(); base.Initialise(); }