Example #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);
    }
 public override void RegisterUndo(GameObject layer, GridBrushBase.Tool tool)
 {
     Undo.RegisterCompleteObjectUndo(LevelBrush.GetWall(), "Paint");
     Undo.RegisterCompleteObjectUndo(LevelBrush.GetFloor(), "Paint");
 }