Exemplo n.º 1
0
 public virtual void BoxFillPreview(GridLayout gridLayout, GameObject brushTarget, BoundsInt position)
 {
     if (brushTarget != null)
     {
         Tilemap component = brushTarget.GetComponent <Tilemap>();
         if (component != null)
         {
             foreach (Vector3Int current in position.allPositionsWithin)
             {
                 Vector3Int          vector3Int = current - position.min;
                 GridBrush.BrushCell brushCell  = this.brush.cells[this.brush.GetCellIndexWrapAround(vector3Int.x, vector3Int.y, vector3Int.z)];
                 if (brushCell.tile != null)
                 {
                     GridBrushEditor.SetTilemapPreviewCell(component, current, brushCell.tile, brushCell.matrix, brushCell.color);
                 }
             }
         }
     }
     this.m_LastGrid        = gridLayout;
     this.m_LastBounds      = new BoundsInt?(position);
     this.m_LastBrushTarget = brushTarget;
     this.m_LastTool        = new GridBrushBase.Tool?(GridBrushBase.Tool.Box);
 }
Exemplo n.º 2
0
        public virtual void PaintPreview(GridLayout gridLayout, GameObject brushTarget, Vector3Int position)
        {
            Vector3Int vector3Int = position - this.brush.pivot;
            Vector3Int a          = vector3Int + this.brush.size;
            BoundsInt  value      = new BoundsInt(vector3Int, a - vector3Int);

            if (brushTarget != null)
            {
                Tilemap component = brushTarget.GetComponent <Tilemap>();
                foreach (Vector3Int current in value.allPositionsWithin)
                {
                    Vector3Int          brushPosition = current - vector3Int;
                    GridBrush.BrushCell brushCell     = this.brush.cells[this.brush.GetCellIndex(brushPosition)];
                    if (brushCell.tile != null && component != null)
                    {
                        GridBrushEditor.SetTilemapPreviewCell(component, current, brushCell.tile, brushCell.matrix, brushCell.color);
                    }
                }
            }
            this.m_LastGrid        = gridLayout;
            this.m_LastBounds      = new BoundsInt?(value);
            this.m_LastBrushTarget = brushTarget;
            this.m_LastTool        = new GridBrushBase.Tool?(GridBrushBase.Tool.Paint);
        }