static public Asf GetAsf(string basePath, string fileName) { if (string.IsNullOrEmpty(fileName)) { return(null); } try { var path = string.IsNullOrEmpty(basePath) ? fileName : Path.Combine(basePath, fileName); if (AsfFiles.ContainsKey(path)) { return(AsfFiles[path]); } else { var asf = new Asf(path); if (asf.IsOk) { AsfFiles[path] = asf; return(asf); } else { return(null); } } } catch (Exception) { return(null); } }
public static Asf[] GetSnowFlake() { var asfs = new Asf[4]; var w = Color.White; var t = Color.Transparent; var data = new Color[3 * 3] { t, w, t, w, w, w, t, w, t }; var texture = new Texture2D(Globals.TheGame.GraphicsDevice, 3, 3); texture.SetData(data); asfs[0] = new Asf(texture); data = new Color[2 * 2] { t, w, w, t }; texture = new Texture2D(Globals.TheGame.GraphicsDevice, 2, 2); texture.SetData(data); asfs[1] = new Asf(texture); data = new Color[2 * 2] { w, t, t, w }; texture = new Texture2D(Globals.TheGame.GraphicsDevice, 2, 2); texture.SetData(data); asfs[2] = new Asf(texture); data = new Color[1] { w }; texture = new Texture2D(Globals.TheGame.GraphicsDevice, 1, 1); texture.SetData(data); asfs[3] = new Asf(texture); return(asfs); }
private void AddDestroySprite(LinkedList <Sprite> list, Vector2 positionInWorld, Asf image, SoundEffect sound) { if (image != null) { var sprite = new Sprite(positionInWorld, 0f, image); sprite.PlayFrames(sprite.FrameCountsPerDirection); list.AddLast(sprite); } SoundManager.Play3DSoundOnece(sound, positionInWorld - Globals.ListenerPosition); UseMagic(BelongMagic.ExplodeMagicFile); }
public Sprite(Vector2 positionInWorld, float velocity, Asf texture, int direction = 0) { Set(positionInWorld, velocity, texture, direction); }