Beispiel #1
0
        public Rect GetWorldBounds(PointF translation)
        {
            Rect rectangleF = default(Rect);

            foreach (TmxObject @object in Objects)
            {
                Rect worldBounds = @object.GetWorldBounds();
                worldBounds.position += new Vector2(translation.X, translation.Y);
                rectangleF            = RectEx.Union(rectangleF, worldBounds);
            }
            return(rectangleF);
        }
        public override Rect GetWorldBounds()
        {
            Rect rectangleF  = new Rect(base.Position.X, base.Position.Y - base.Size.Height, base.Size.Width, base.Size.Height);
            Rect worldBounds = Tile.ObjectGroup.GetWorldBounds(base.Position);

            if (worldBounds == Rect.zero)
            {
                return(rectangleF);
            }

            return(RectEx.Union(rectangleF, worldBounds));
        }