//particleEmitter optional, object with more properties //particleEmitters optional, list of particleEmitter public void InitializeAssets(string assetDirectory) { // @TODO: Don't use image copies, go deeper and make the ImageLoader cache its own results if (ImageName != null) MainImage = new ObjectImageManager(ImageName, assetDirectory, false); if (DualImageName != null) DualImage = new ObjectImageManager(DualImageName, assetDirectory, false); if (LeftImageName != null) LeftImage = new ObjectImageManager(LeftImageName, assetDirectory, false); if (RightImageName != null) RightImage = new ObjectImageManager(RightImageName, assetDirectory, false); if ( ImageLayers != null && ImageLayers.Count > 0 ) { // @TODO: Layers not supported MainImage = new ObjectImageManager(ImageLayers[0].ImageName, assetDirectory, false); } if ( DualImage != null ) { if (RightImage == null) { RightImage = DualImage; } if ( LeftImage == null ) { // @TODO: Deal with this, useless copy invokes ImageLoader to load the image LeftImage = new ObjectImageManager(DualImageName, assetDirectory, true); } if ( MainImage == null ) { MainImage = DualImage; } } }
public void Dispose() { if ( MainImage != null ) { MainImage.Dispose(); MainImage = null; } if ( DualImage != null ) { DualImage.Dispose(); DualImage = null; } if ( LeftImage != null ) { LeftImage.Dispose(); LeftImage = null; } if ( RightImage != null ) { RightImage.Dispose(); RightImage = null; } }