/// <summary> /// Constructs a random sprite with all the appropriate timing /// and color information required. /// </summary> public ISprite CreateRandomSprite() { // Get a random type AssetSprite ras = RandomAssetSprite; if (ras.Drawables.Count == 0) { throw new Exception("No defined sprites for " + ras.Name); } // If we have one frame, its simple if (ras.Drawables.Count == 1) { ISprite ds = new DrawableSprite(ras.Drawables[0]); ds.ID = name; return(ds); } // Otherwise, create a fixed rate (for now) FixedRateDrawableSprite fix = new FixedRateDrawableSprite(); fix.FPS = 3; fix.ID = name; fix.Drawables.AddAll(ras.Drawables); return(fix); }
/// <summary> /// Constructs a random sprite with all the appropriate timing /// and color information required. /// </summary> public ISprite CreateRandomSprite() { // Get a random type AssetSprite ras = RandomAssetSprite; if (ras.Drawables.Count == 0) throw new Exception("No defined sprites for " + ras.Name); // If we have one frame, its simple if (ras.Drawables.Count == 1) { ISprite ds = new DrawableSprite(ras.Drawables[0]); ds.ID = name; return ds; } // Otherwise, create a fixed rate (for now) FixedRateDrawableSprite fix = new FixedRateDrawableSprite(); fix.FPS = 3; fix.ID = name; fix.Drawables.AddAll(ras.Drawables); return fix; }