/// <summary> /// Draws the animation with the given SpriteBatch. /// </summary> public virtual void Draw(SpriteBatch spriteBatch) { for (int i = 0; i < DrawInfos.Count; ++i) { SpriteDrawInfo di = DrawInfos[i]; ISprite sprite = di.Drawable; sprite.Draw(spriteBatch, di.Pivot, di.Position, di.Scale, di.Rotation, di.Color, di.Depth); } }
protected override void ApplySpriteTransform(ISprite drawable, SpriterObject info) { float posX, posY, rotation; GetPositionAndRotation(info, out posX, out posY, out rotation); SpriteDrawInfo di = DrawInfoPool.Count > 0 ? DrawInfoPool.Pop() : new SpriteDrawInfo(); di.Drawable = drawable; di.Pivot = new Vector2(info.PivotX, (1 - info.PivotY)); di.Position = new Vector2(posX, posY); di.Scale = new Vector2(info.ScaleX, info.ScaleY) * Scale; di.Rotation = rotation; di.Color = Color * info.Alpha; di.Depth = Depth + DeltaDepth * DrawInfos.Count; DrawInfos.Add(di); }