public void AddAnimation(string animationKey, string textureName, CelRange celRange, int celWidth, int celHeight, int numberOfCels, int framesPerSecond) { CelAnimation ca = new CelAnimation(textureName, celRange, framesPerSecond); if (!textures.ContainsKey(textureName)) { textures.Add(textureName, content.Load <Texture2D>(contentPath + textureName)); } ca.CelWidth = celWidth; ca.CelHeight = celHeight; ca.NumberOfCels = numberOfCels; ca.CelsPerRow = textures[textureName].Width / celWidth; if (animations.ContainsKey(animationKey)) { animations[animationKey] = ca; } else { animations.Add(animationKey, ca); } }
public CelAnimation(string textureName, CelRange celRange, int framesPerSecond) { this.textureName = textureName; this.celRange = celRange; this.framesPerSecond = framesPerSecond; this.timePerFrame = 1.0f / (float)framesPerSecond; this.Frame = 0; this.StillFrame = 0; this.loopCount = 0; }