Example #1
0
        /// <summary>
        /// Picks the tint color given the coordinates of the cells.
        /// The TintBrushSmoot overrides this to provide color picking functionality.
        /// </summary>
        /// <param name="grid">Grid to pick data from.</param>
        /// <param name="brushTarget">Target of the picking operation. By default the currently selected GameObject.</param>
        /// <param name="position">The coordinates of the cells to paint data from.</param>
        /// <param name="pivot">Pivot of the picking brush.</param>
        public override void Pick(GridLayout grid, GameObject brushTarget, BoundsInt position, Vector3Int pivot)
        {
            TintTextureGenerator generator = GetGenerator(grid);

            if (generator != null)
            {
                m_Color = generator.GetColor(grid as Grid, position.min);
            }
        }
Example #2
0
        /// <summary>
        /// Tints tiles into a given position within the selected layers.
        /// The TintBrushSmooth overrides this to set the color of the Grid position to tint it.
        /// </summary>
        /// <param name="grid">Grid used for layout.</param>
        /// <param name="brushTarget">Target of the paint operation. By default the currently selected GameObject.</param>
        /// <param name="position">The coordinates of the cell to paint data to.</param>
        public override void Paint(GridLayout grid, GameObject brushTarget, Vector3Int position)
        {
            TintTextureGenerator generator = GetGenerator(grid);

            if (generator != null)
            {
                var oldColor   = generator.GetColor(grid as Grid, position);
                var blendColor = oldColor * (1 - m_Blend) + m_Color * m_Blend;
                generator.SetColor(grid as Grid, position, blendColor);
            }
        }
Example #3
0
		public override void Pick(GridLayout grid, GameObject brushTarget, BoundsInt position, Vector3Int pivot)
		{
			// Do not allow editing palettes
			if (brushTarget.layer == 31)
				return;

			TintTextureGenerator generator = GetGenerator(grid);
			if (generator != null)
			{
				m_Color = generator.GetColor(grid as Grid, position.min);
			}
		}
Example #4
0
        /// <summary>
        /// Tints tiles into a given position within the selected layers.
        /// The TintBrushSmooth overrides this to set the color of the Grid position to tint it.
        /// </summary>
        /// <param name="gridLayout">Grid used for layout.</param>
        /// <param name="brushTarget">Target of the paint operation. By default the currently selected GameObject.</param>
        /// <param name="position">The coordinates of the cell to paint data to.</param>
        public override void Paint(GridLayout grid, GameObject brushTarget, Vector3Int position)
        {
            // Do not allow editing palettes
            if (brushTarget.layer == 31)
            {
                return;
            }

            TintTextureGenerator generator = GetGenerator(grid);

            if (generator != null)
            {
                var oldColor   = generator.GetColor(grid as Grid, position);
                var blendColor = oldColor * (1 - m_Blend) + m_Color * m_Blend;
                generator.SetColor(grid as Grid, position, blendColor);
            }
        }