/// <summary> /// Append the sprite. /// </summary> /// <param name="sprite">Sprite.</param> /// <param name="duration">Duration of the sprite in milliseconds. /// Note that it is different from when instancing the Animation directly</param> public void AppendSprite(IntRect sprite, Vector2f soffset, int duration, string sfx = "") { var end = duration + this.endRef; if (sfx != "") { if (IoManager.LoadSound(sfx) == null) { // cannot load the sound, useless to set it sfx = ""; } } var kf = new KeyFrame() { millis = end, rect = sprite, offset = soffset, sfx = sfx }; //Console.WriteLine ("Appending sprite " + kf.rect.ToString() + " ending at " + end.ToString()); this.frames.Add(kf); this.endRef += duration; }
public SfxSpawner(string sfx) { this.sfx = sfx; IoManager.LoadSound(sfx); }