public static AnimationSet BuildFromAsset(string[] lines, float scaleOverride = 1.0f) { var animationSet = new AnimationSet(); int animationIndex = 0; int directionIndex = 0; List<string> currentlyBuildingAnimationLines = new List<string>(); foreach (var line in lines) { if(line.StartsWith(";")) { if (currentlyBuildingAnimationLines.Count > 0) { if (!animationSet.animations.ContainsKey(animationIndex)) { animationSet.animations.Add(animationIndex, new Animation[4]); } animationSet.animations[animationIndex][directionIndex] = Animation.BuildFromDataLines(currentlyBuildingAnimationLines.ToArray<string>(), scaleOverride); } var indexes = line.Split(';'); animationIndex = int.Parse(indexes[1]); directionIndex = int.Parse(indexes[2]); currentlyBuildingAnimationLines = new List<string>(); continue; } currentlyBuildingAnimationLines.Add(line); } if (currentlyBuildingAnimationLines.Count > 0) { //dont forget the last animation! repeated code... if (!animationSet.animations.ContainsKey(animationIndex)) { animationSet.animations.Add(animationIndex, new Animation[4]); } animationSet.animations[animationIndex][directionIndex] = Animation.BuildFromDataLines(currentlyBuildingAnimationLines.ToArray<string>(), scaleOverride); } return animationSet; }
public RenderBase(IRenderable owner, Texture2D texture, AnimationSet animationSet) { this.owner = owner; this.owner.Texture = texture; this.animationSet = animationSet; }