/// <summary> /// Removes all components. /// </summary> /// <param name="context">The context.</param> public static void RemoveAllComponents(this IWorldContext context) { foreach (var c in context.Components) { context.RemoveComponent(c); } }
private Score(Point position, Snake snake, IWorldContext ctx) : base(position, ctx) { snake.FoodEaten += delegate { var effect = new RectangleComponent(snake.Head.Transform.Position, ctx) { Pixel = '+'.DarkRed() }; effect .Transform .MoveTo(Transform.Position, 1f, Easing.OutCubic) .Do(() => { ctx.RemoveComponent(effect); }) .Once(); this .To(points, points + 10, 1f, Easing.InOutQuint, v => points = (int)v) .Once(); }; Transform.CentralizePivot(); }
/// <summary> /// Removes the components without tag. /// </summary> /// <param name="context">The context.</param> /// <param name="tags">The tags.</param> public static void RemoveComponentsWithoutTag(this IWorldContext context, params string[] tags) { var toRemove = context.Components.GetWithoutTag(tags); foreach (var c in toRemove) { context.RemoveComponent(c); } }