Пример #1
0
        private void DrawEllipse(Graphics g, Pen pen, Brush brush, TmxObjectEllipse tmxEllipse)
        {
            RectangleF rc = new RectangleF(new PointF(0, 0), tmxEllipse.Size);

            if (this.tmxMap.Orientation == TmxMap.MapOrientation.Isometric)
            {
                // Circles and ellipses not supported in Insometric mode
                g.FillEllipse(Brushes.Red, rc);
                g.DrawEllipse(Pens.White, rc);

                string message = String.Format(" Not supported (isometric): {0}", tmxEllipse.GetNonEmptyName());
                DrawString(g, message, rc.X + rc.Width * 0.5f, rc.Y + rc.Height * 0.5f);
            }
            else if (!tmxEllipse.IsCircle())
            {
                // We don't really support ellipses, especially as colliders
                g.FillEllipse(Brushes.Red, rc);
                g.DrawEllipse(Pens.White, rc);

                string message = String.Format(" Not supported (ellipse): {0}", tmxEllipse.GetNonEmptyName());
                DrawString(g, message, rc.X + rc.Width * 0.5f, rc.Y + rc.Height * 0.5f);
            }
            else
            {
                g.FillEllipse(brush, rc);
                g.DrawEllipse(pen, rc);
            }
        }
        private XElement CreateCircleColliderElement(TmxObjectEllipse tmxEllipse, string objGroupName)
        {
            if (!tmxEllipse.IsCircle())
            {
                Program.WriteError("Collision ellipse in Object Layer '{0}' is not a circle: {1}", objGroupName, tmxEllipse);
                return(null);
            }
            else
            {
                XElement circleCollider =
                    new XElement("CircleCollider2D",
                                 new XAttribute("radius", tmxEllipse.Radius * Program.Scale));

                return(circleCollider);
            }
        }
Пример #3
0
        private void DrawEllipse(Graphics g, Pen pen, Brush brush, TmxObjectEllipse tmxEllipse)
        {
            RectangleF rc = new RectangleF(new PointF(0, 0), tmxEllipse.Size);

            if (tmxEllipse.IsCircle())
            {
                g.FillEllipse(brush, rc);
                g.DrawEllipse(pen, rc);
            }
            else
            {
                // We don't really support ellipses, especially as colliders
                g.FillEllipse(Brushes.Red, rc);
                g.DrawEllipse(Pens.White, rc);

                string message = String.Format(" Not a circle: {0}", tmxEllipse.GetNonEmptyName());
                DrawString(g, message, rc.X + rc.Width * 0.5f, rc.Y + rc.Height * 0.5f);
            }
        }
        private XElement CreateCircleColliderElement(TmxObjectEllipse tmxEllipse, string objGroupName)
        {
            if (this.tmxMap.Orientation == TmxMap.MapOrientation.Isometric)
            {
                Logger.WriteError("Collision ellipse in Object Layer '{0}' is not supported in Isometric maps: {1}", objGroupName, tmxEllipse);
                return(null);
            }
            else if (!tmxEllipse.IsCircle())
            {
                Logger.WriteError("Collision ellipse in Object Layer '{0}' is not a circle: {1}", objGroupName, tmxEllipse);
                return(null);
            }
            else
            {
                XElement circleCollider =
                    new XElement("CircleCollider2D",
                                 new XAttribute("radius", tmxEllipse.Radius * Tiled2Unity.Settings.Scale));

                return(circleCollider);
            }
        }
Пример #5
0
        private void DrawEllipse(Graphics g, Pen pen, Brush brush, TmxObjectEllipse tmxEllipse)
        {
            RectangleF rc = new RectangleF(new PointF(0, 0), tmxEllipse.Size);
            if (this.tmxMap.Orientation == TmxMap.MapOrientation.Isometric)
            {
                // Circles and ellipses not supported in Insometric mode
                g.FillEllipse(Brushes.Red, rc);
                g.DrawEllipse(Pens.White, rc);

                string message = String.Format(" Not supported (isometric): {0}", tmxEllipse.GetNonEmptyName());
                DrawString(g, message, rc.X + rc.Width * 0.5f, rc.Y + rc.Height * 0.5f);
            }
            else if (!tmxEllipse.IsCircle())
            {
                // We don't really support ellipses, especially as colliders
                g.FillEllipse(Brushes.Red, rc);
                g.DrawEllipse(Pens.White, rc);

                string message = String.Format(" Not supported (ellipse): {0}", tmxEllipse.GetNonEmptyName());
                DrawString(g, message, rc.X + rc.Width * 0.5f, rc.Y + rc.Height * 0.5f);
            }
            else
            {
                g.FillEllipse(brush, rc);
                g.DrawEllipse(pen, rc);
            }
        }
        private XElement CreateCircleColliderElement(TmxObjectEllipse tmxEllipse, string objGroupName)
        {
            if (this.tmxMap.Orientation == TmxMap.MapOrientation.Isometric)
            {
                Logger.WriteError("Collision ellipse in Object Layer '{0}' is not supported in Isometric maps: {1}", objGroupName, tmxEllipse);
                return null;
            }
            else if (!tmxEllipse.IsCircle())
            {
                Logger.WriteError("Collision ellipse in Object Layer '{0}' is not a circle: {1}", objGroupName, tmxEllipse);
                return null;
            }
            else
            {
                XElement circleCollider =
                    new XElement("CircleCollider2D",
                        new XAttribute("radius", tmxEllipse.Radius * Tiled2Unity.Settings.Scale));

                return circleCollider;
            }
        }