public static Obstacle CreateNew(Layer layer) { if (string.IsNullOrEmpty(mContentManagerName)) { throw new System.Exception("You must first initialize the factory to use it."); } Obstacle instance = null; instance = new Obstacle(mContentManagerName, false); instance.AddToManagers(layer); if (mScreenListReference != null) { mScreenListReference.Add(instance); } if (EntitySpawned != null) { EntitySpawned(instance); } return instance; }