コード例 #1
0
    private void OnDrawGizmosSelected()
    {
        float yPos = transform.position.y;

        for (int y = 0; y < ySize; y++)
        {
            float xPos = transform.position.x;
            for (int x = 0; x < xSize; x++)
            {
                Gizmos.DrawSphere(new Vector3(xPos, yPos, 0f), 0.1f);
                xPos = xPos + xCellSize;
            }
            yPos = yPos + yCellSize;
        }


        if (!Application.isPlaying)
        {
            CalculateBorderRect();
        }

        HelperFs.GizmosDrawRect(border);

        if (Application.isPlaying)
        {
            Gizmos.color = Color.red;
            Gizmos.DrawSphere(new Vector3(worldXMin, 0, 0f), 0.1f);
            Gizmos.DrawSphere(new Vector3(worldXMax, 0, 0f), 0.1f);
        }
    }
コード例 #2
0
    private void OnDrawGizmosSelected()
    {
        Gizmos.color = Color.red;

        Gizmos.DrawSphere(BoardLeftBottom, 0.2f);

        HelperFs.GizmosDrawRect(new Rect(BoardLeftBottom, CameraWidth * 2 * Vector2.one));


        Gizmos.color = Color.grey;

        CalculateTileSize();

        float posy = BoardLeftBottom.y + tileSize * 0.5f;

        for (int y = 0; y < boardSize; y++)
        {
            float posx = BoardLeftBottom.x + tileSize * 0.5f;

            for (int x = 0; x < boardSize; x++)
            {
                Gizmos.DrawSphere(new Vector3(posx, posy), 0.2f);

                posx += tileSize + spacing;
            }
            posy += tileSize + spacing;
        }
    }