public Anim Play(string name = "", bool reset = false, int frame = 0) { if (!reset && anim != null && anim.Name == name) return anim; anim = anims[name]; if (anim == null) { frame = 0; //(uint) index; // = (uint) 0; index = 0; Complete = true; updateClipRect(); return null; } index = 0; timer = 0; int setFrame = frame % (int) anim.frameCount; this.frame = (uint) anim.frames[setFrame]; Complete = false; updateClipRect(); return anim; }
public Anim Add(string name, int[] frames, double frameRate = 0, bool loop = true) { if (anims.ContainsKey(name) ) throw new Exception("Cannot have multiple animations with the same name"); (anims[name] = new Anim(name, frames, frameRate, loop)).parent = this; return anims[name]; }