コード例 #1
0
    bool InitializeCachedReferences()
    {
        if (floor == null)
        {
            floor = LevelBrush.GetFloor();
        }
        if (wall == null)
        {
            wall = LevelBrush.GetWall();
        }
        if (gi == null)
        {
            gi = GetComponentInParent <GridInformation>();
        }

        if (tintTexture == null)
        {
            tintTexture            = new Texture2D(256, 256, TextureFormat.ARGB32, false);
            tintTexture.wrapMode   = TextureWrapMode.Clamp;
            tintTexture.filterMode = FilterMode.Bilinear;
        }
        colorArray = new Color32[tintTexture.width * tintTexture.height];

        LevelBrush.InitializeLevelCacheIfNecessary();

        return(floor && wall & gi & tintTexture);
    }
コード例 #2
0
    public override void OnPaintSceneGUI(GridLayout grid, GameObject layer, BoundsInt position, GridBrushBase.Tool tool, bool executing)
    {
        LevelBrush.InitializeLevelCacheIfNecessary();
        var invalidFloors = LevelBrush.GetAllInvalidFloors();

        BrushEditorUtility.BeginQuads(new Color(1f, 0f, 0f, 0.5f));
        foreach (var pos in invalidFloors)
        {
            BrushEditorUtility.DrawQuadBatched(grid, pos);
        }
        BrushEditorUtility.EndQuads();

        base.OnPaintSceneGUI(grid, layer, position, tool, executing);
    }