コード例 #1
0
 public void Execute(Entity ent, int idx, [ReadOnly] ref Translation trans)
 {
     if (BoundUtil.IsOutOfBounds(bounds, trans.Value.x, trans.Value.y))
     {
         commandBuffer.DestroyEntity(idx, ent);
     }
 }
コード例 #2
0
 public void Execute(Entity ent, int idx, [ReadOnly] ref Translation pos)
 {
     if (idx == 0)
     {
         BoundUtil.DefaultBounds(bounds);
     }
     BoundUtil.UpdateBounds(pos, bounds);
 }
コード例 #3
0
 public void Execute(ref Translation trans)
 {
     if (BoundUtil.IsAboveTop(bounds, trans.Value.y))
     {
         trans.Value.y = BoundUtil.Top(bounds);
     }
     if (BoundUtil.IsBelowBottom(bounds, trans.Value.y))
     {
         trans.Value.y = BoundUtil.Bottom(bounds);
     }
     if (BoundUtil.IsAboveRight(bounds, trans.Value.x))
     {
         trans.Value.x = BoundUtil.Right(bounds);
     }
     if (BoundUtil.IsBelowLeft(bounds, trans.Value.x))
     {
         trans.Value.x = BoundUtil.Left(bounds);
     }
 }
コード例 #4
0
        public void Execute(Entity ent, int idx, [ReadOnly] ref Translation trans,
                            [ReadOnly] ref BoundMarkerConvert convert)
        {
            if (!BoundUtil.IsOutOfBounds(bounds, trans.Value.x, trans.Value.y))
            {
                commandBuffer.RemoveComponent(idx, ent, typeof(BoundMarkerConvert));

                // add new marker
                switch (convert.newMarker)
                {
                case InteractionType.KeepIn:
                    commandBuffer.AddComponent(idx, ent, new BoundMarkerIn());
                    break;

                case InteractionType.DeleteOutside:
                    commandBuffer.AddComponent(idx, ent, new BoundMarkerDelete());
                    break;
                }
            }
        }