Exemplo n.º 1
0
        private static ILDtkHandleDrawer DrawEntity(LDtkEntityDrawerData entity)
        {
            Vector2 offset = Vector2.down;

            if (entity.Transform == null || !entity.Transform.gameObject.activeInHierarchy)
            {
                return(null);
            }

            switch (entity.EntityMode)
            {
            case RenderMode.Cross:
            case RenderMode.Ellipse:
            case RenderMode.Rectangle:
                LDtkEntityDrawerShapes.Data shapeData = new LDtkEntityDrawerShapes.Data()
                {
                    EntityMode  = entity.EntityMode,
                    FillOpacity = entity.FillOpacity,
                    LineOpacity = entity.LineOpacity,
                    Hollow      = entity.Hollow,
                    Pivot       = entity.Pivot,
                    Size        = entity.Size
                };
                LDtkEntityDrawerShapes entityDrawer = new LDtkEntityDrawerShapes(entity.Transform, shapeData);
                entityDrawer.OnDrawHandles();
                break;
            }

            if (entity.DrawTile)
            {
                LDtkEntityDrawerIcon iconDrawer = new LDtkEntityDrawerIcon(entity.Transform, entity.Tex, entity.TexRect);
                iconDrawer.PrecalculateValues();
                offset = iconDrawer.OffsetToNextUI;
                iconDrawer.OnDrawHandles();
            }

            if (entity.ShowName && LDtkPrefs.ShowEntityIdentifier)
            {
                HandleUtil.DrawText(entity.Identifier, entity.Transform.position, entity.GizmoColor, offset, () => Selection.activeGameObject = entity.Transform.gameObject);
            }

            return(null);
        }
Exemplo n.º 2
0
 public void DrawLabel()
 {
     if (LDtkPrefs.ShowLevelIdentifier)
     {
         //todo add color to this label perhaps
         HandleUtil.DrawText(_identifier, _position, _bgColor, default, () => HandleUtil.SelectIfNotAlreadySelected(_obj));