コード例 #1
0
ファイル: DebugDraw.cs プロジェクト: SergejKern1/LevelEditor
        static void DrawTile(TilesSetData tilesSetData, DebugDrawSettings settings, float rx, Vector3 pos, float rz, ushort tile)
        {
            var center = new Vector3(rx,
                                     pos.y * settings.YMult.y + rz * settings.ZMult.y,
                                     rz * settings.ZMult.z + pos.y * settings.YMult.z);

            GetDebugDrawVertices(settings, center, out var v1, out var v2, out var v3, out var v4);
            GetDebugDrawColor(settings, tilesSetData, tile, out var faceCol, out var outlineCol);

            var previewTex = tilesSetData[tile].PreviewTex;

            if (settings.DrawDebugTiles)
            {
                Handles.DrawSolidRectangleWithOutline(new[] { v1, v2, v3, v4 }, faceCol, outlineCol);
            }

            var label = settings.DrawLabel ? tilesSetData[tile].TileName : "";
            var image = settings.DrawDots ? previewTex : null;

            if (settings.DrawDots || settings.DrawLabel)
            {
                Handles.Label(center, new GUIContent()
                {
                    text = label, image = image
                });
            }
        }
コード例 #2
0
ファイル: DebugDraw.cs プロジェクト: SergejKern1/LevelEditor
        public static void DrawGeometryType(IPlatformLayer layer,
                                            TilesSetData tilesSetData, DebugDrawSettings settings)
        {
            var posOffset = layer.PositionOffset;
            var gridSize  = layer.GridSize;

            for (var x = 0; x < layer.TileDim.x; ++x)
            {
                for (var z = 0; z < layer.TileDim.y; ++z)
                {
                    var pos = new Vector3(posOffset.x + layer.Position.x, posOffset.y, posOffset.z + layer.Position.y);
                    var rx  = gridSize * x + pos.x;
                    var rz  = gridSize * z + pos.z;

                    var tile = tilesSetData.GetTileIdx(GetTile(layer, layer, x, z));

                    if (tile >= tilesSetData.Count)
                    {
                        return;
                    }

                    DrawTile(tilesSetData, settings, rx, pos, rz, tile);
                }
            }
        }
コード例 #3
0
ファイル: XDebug.cs プロジェクト: AlexTagun/Xelon
    // ------------------------- drawRectangle ---------------------------------

    public static void drawRectangle(Vector2 inPosition, Vector2 inSize, float inRotation,
                                     DebugDrawSettings inDrawSettings)
    {
        Vector2 theXSideVector = XMath.rotate(new Vector2(inSize.x, 0.0f), inRotation);
        Vector2 theYSideVector = XMath.rotate(new Vector2(0.0f, inSize.y), inRotation);

        Vector2 theRectCornerPosition = inPosition +
                                        XMath.rotate(new Vector2(-inSize.x / 2, -inSize.y / 2), inRotation);

        Vector2 theLastRectCornerPosition = theRectCornerPosition;

        theRectCornerPosition += theXSideVector;
        Debug.DrawLine(theLastRectCornerPosition, theRectCornerPosition,
                       inDrawSettings.color, inDrawSettings.duration, inDrawSettings.doDepthTest
                       );

        theLastRectCornerPosition = theRectCornerPosition;
        theRectCornerPosition    += theYSideVector;
        Debug.DrawLine(theLastRectCornerPosition, theRectCornerPosition,
                       inDrawSettings.color, inDrawSettings.duration, inDrawSettings.doDepthTest
                       );

        theLastRectCornerPosition = theRectCornerPosition;
        theRectCornerPosition    -= theXSideVector;
        Debug.DrawLine(theLastRectCornerPosition, theRectCornerPosition,
                       inDrawSettings.color, inDrawSettings.duration, inDrawSettings.doDepthTest
                       );

        theLastRectCornerPosition = theRectCornerPosition;
        theRectCornerPosition    -= theYSideVector;
        Debug.DrawLine(theLastRectCornerPosition, theRectCornerPosition,
                       inDrawSettings.color, inDrawSettings.duration, inDrawSettings.doDepthTest
                       );
    }
コード例 #4
0
ファイル: DebugDraw.cs プロジェクト: SergejKern1/LevelEditor
        static void GetDebugDrawVertices(DebugDrawSettings settings, Vector3 center, out Vector3 v1, out Vector3 v2, out Vector3 v3,
                                         out Vector3 v4)
        {
            var debugTileSize = settings.DebugTileSize;

            v1 = center + new Vector3(-debugTileSize, -debugTileSize * settings.ZMult.y, -debugTileSize * settings.ZMult.z);
            v2 = center + new Vector3(debugTileSize, -debugTileSize * settings.ZMult.y, -debugTileSize * settings.ZMult.z);
            v3 = center + new Vector3(debugTileSize, debugTileSize * settings.ZMult.y, debugTileSize * settings.ZMult.z);
            v4 = center + new Vector3(-debugTileSize, debugTileSize * settings.ZMult.y, debugTileSize * settings.ZMult.z);
        }
コード例 #5
0
ファイル: XDebug.cs プロジェクト: AlexTagun/Xelon
    // --------------------------- drawCross -----------------------------------

    public static void drawCross(Vector2 inPosition, DebugDrawSettings inDrawSettings)
    {
        const float theCrossSize = 0.3f;

        Debug.DrawLine(
            new Vector2(inPosition.x - theCrossSize, inPosition.y),
            new Vector2(inPosition.x + theCrossSize, inPosition.y),
            inDrawSettings.color, inDrawSettings.duration, inDrawSettings.doDepthTest
            );

        Debug.DrawLine(
            new Vector2(inPosition.x, inPosition.y - theCrossSize),
            new Vector2(inPosition.x, inPosition.y + theCrossSize),
            inDrawSettings.color, inDrawSettings.duration, inDrawSettings.doDepthTest
            );
    }
コード例 #6
0
ファイル: DebugDraw.cs プロジェクト: SergejKern1/LevelEditor
 static void GetDebugDrawColor(DebugDrawSettings settings, TilesSetData tilesSetData, ushort tile, out Color faceCol, out Color outlineCol)
 {
     faceCol    = tilesSetData[tile].TileColor;
     faceCol.a *= settings.ColorAlpha;
     outlineCol = tilesSetData[tile].TileColor;
 }