public TdglComponentManager(Game game, UiComponentManager uiManager)
            : base(game)
        {
            //Game.Components.Add(this);

            _xnaComponents = new List <GameComponent>();
            _components    = new MutableDistinctSet <TdglComponent>();

            _componentsSortedByDrawOrder = new List <TdglComponent>();
            _componentDrawOrders         = new Dictionary <TdglComponent, int>();

            DrawOrder = GameEnvironment.GamePlayManagerDrawOrder;

            UiManager           = AddComponent(uiManager);
            UiManager.DrawOrder = 1;
        }
 public static void StartServices()
 {
     if (GamePlayComponentManager != null)
     {
         throw new InvalidOperationException("Service already started.");
     }
     else
     {
         // Top level services
         UiManager = new UiComponentManager(SpriteBatch)
         {
             IsPauseIgnored = true
         };
         GamePlayComponentManager = new TdglComponentManager(GameEnvironment.Game, UiManager);
         WorldManager             = GamePlayComponentManager.AddComponent(new WorldManager(new World(Vector2.Zero)));
         GhostBodyManager         = GamePlayComponentManager.AddComponent(new GhostBodyManager());
         PooledBodyManager        = GamePlayComponentManager.AddComponent(new PooledBodyManager(WorldManager, GhostBodyManager));
         MobManager  = GamePlayComponentManager.AddComponent(new MobManager(WorldManager));
         DrawUtility = GamePlayComponentManager.AddComponent(new DrawUtility(SpriteBatch));
     }
 }