private IEnumerator DelayedPaint(P3D_Paintable paintable, Vector2 uv, float distance01)
    {
        // Delay it based on how far the ray travelled to hit
        yield return(new WaitForSeconds(distance01 * MaxDelay));

        // Make sure the paintable still exists
        if (paintable != null)
        {
            // Make a temp brush clone so we can alter some settings without changing our actual brush
            var tempBrush = Brush.GetTempClone();

            // Set the opacity to be based on distance
            tempBrush.Opacity *= 1.0f - distance01;

            // Paint using our modified brush
            paintable.Paint(tempBrush, uv);
        }
    }
Exemple #2
0
    private void Paint(Vector2 uv)
    {
        var tempBrush = currentBrush.GetTempClone();

        if (scatterPosition != 0.0f)
        {
            var direction = Random.insideUnitCircle;

            tempBrush.Offset.x += Mathf.RoundToInt(direction.x * scatterPosition);
            tempBrush.Offset.y += Mathf.RoundToInt(direction.y * scatterPosition);
        }

        if (scatterAngle > 0.0f)
        {
            tempBrush.Angle += Random.Range(-scatterAngle, scatterAngle);
        }

        if (scatterScale > 0.0f)
        {
            tempBrush.Size *= Random.Range(1.0f - scatterScale, 1.0f);
        }

        painter.Paint(tempBrush, uv);
    }