예제 #1
0
 /// <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);
     }
 }
예제 #2
0
파일: Score.cs 프로젝트: giacomelli/Doog
        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();
        }
예제 #3
0
        /// <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);
            }
        }