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); }
void Refresh() { if (!BeginUpdate()) { return; } foreach (var pos in LevelBrush.GetWall().cellBounds.allPositionsWithin) { colorArray[WorldToIndex(pos)] = GetColor(pos); } EndBatchedUpdate(); Shader.SetGlobalTexture("_TintMap", tintTexture); }
public override void RegisterUndo(GameObject layer, GridBrushBase.Tool tool) { Undo.RegisterCompleteObjectUndo(LevelBrush.GetWall(), "Paint"); Undo.RegisterCompleteObjectUndo(LevelBrush.GetFloor(), "Paint"); }