public static void RageGroupApplyTexturing()
    {
        var selectedGameObject = Selection.activeTransform.gameObject;

        if (!HasSplineAndGroup(selectedGameObject))
        {
            Debug.Log("Macro Error: First select a RageSpline object which has a parent or attached RageGroup");
            return;
        }
        Vector2 offset    = _refSpline.GetTextureOffset();
        float   angleDeg  = _refSpline.GetTextureAngleDeg();
        float   scaleInv  = _refSpline.GetTextureScaleInv();
        Vector2 offset2   = _refSpline.GetTextureOffset2();
        float   angle2Deg = _refSpline.GetTextureAngle2Deg();
        float   scale2Inv = _refSpline.GetTextureScale2Inv();

        foreach (RageGroupElement groupItem in _group.List)
        {
            RageSpline thisSpline  = groupItem.Spline.Rs;
            Vector2    offsetDelta = _refSpline.transform.position - thisSpline.transform.position;
            RageSpline.CopyStyling(ref _refSpline, thisSpline);
            thisSpline.CopyMaterial(_refSpline);
            thisSpline.SetTextureOffset(offset + offsetDelta);
            thisSpline.SetTextureAngleDeg(angleDeg);
            thisSpline.SetTextureScaleInv(scaleInv);
            thisSpline.SetTextureOffset2(offset2 + offsetDelta);
            thisSpline.SetTextureAngle2Deg(angle2Deg);
            thisSpline.SetTextureScale2Inv(scale2Inv);
            thisSpline.RefreshMeshInEditor(true, true, true);
        }
        Debug.Log("Macro: Texturing applied to all RageGroup members.");
    }
Ejemplo n.º 2
0
        public static int Redraw(this RageSpline rageSpline, bool triangulate, bool calculateNormals, bool calculatePhysics, int startNormals, float percentNormals)
        {
            rageSpline.SetVertexCount(rageSpline.GetVertexCount());

            if (Mathf.Abs(rageSpline.gameObject.transform.localScale.x) <= 0f ||
                Mathf.Abs(rageSpline.gameObject.transform.localScale.y) <= 0f)
            {
                return(startNormals);
            }

            int points = rageSpline.GetVertexCount() + 1;
            int end    = (int)(points * percentNormals);

            if (end > points)
            {
                end = points;
            }

            if (calculateNormals)
            {
                ProgressivePrecalcNormals(rageSpline, startNormals, end);
            }

            GenerateMesh(rageSpline, triangulate);

            if (calculatePhysics)
            {
                rageSpline.RefreshPhysics();
            }

            return(end >= points ? 0 : end);
        }
Ejemplo n.º 3
0
 public void SetCreatePhysicsInEditor(bool createInEditor, RageSpline caller)
 {
     if (this.createPhysicsInEditor != createInEditor)
     {
         this.createPhysicsInEditor = createInEditor;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
Ejemplo n.º 4
0
 public void SetOptimize(bool optimize, RageSpline caller)
 {
     if (this.optimize != optimize)
     {
         this.optimize = optimize;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
Ejemplo n.º 5
0
 public void SetPhysics(RageSpline.Physics physics, RageSpline caller)
 {
     if (this.physics != physics)
     {
         this.physics = physics;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
Ejemplo n.º 6
0
 public void SetAntialiasingWidth(float width, RageSpline caller)
 {
     if (this.antiAliasingWidth != width)
     {
         this.antiAliasingWidth = Mathf.Clamp(width, 0f, 1000f);
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
Ejemplo n.º 7
0
 public void SetOutlineTexturingScaleInv(float scale, RageSpline caller)
 {
     if (this.outlineTexturingScale != scale)
     {
         this.outlineTexturingScale = Mathf.Clamp(scale, 0.001f, 1000f);
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
Ejemplo n.º 8
0
 public void SetPhysicsColliderCount(int count, RageSpline caller)
 {
     if (this.physicsColliderCount != count)
     {
         this.physicsColliderCount = count;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
Ejemplo n.º 9
0
 public void SetPhysicsZDepth(float depth, RageSpline caller)
 {
     if (this.colliderZDepth != depth)
     {
         this.colliderZDepth = depth;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
Ejemplo n.º 10
0
 public void SetTextureScale2Inv(float scale, RageSpline caller)
 {
     if (this.textureScale2 != scale)
     {
         this.textureScale2 = Mathf.Clamp(scale, 0.00001f, 100f);
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
Ejemplo n.º 11
0
 public void SetEmboss(RageSpline.Emboss emboss, RageSpline caller)
 {
     if (this.emboss != emboss)
     {
         this.emboss = emboss;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
Ejemplo n.º 12
0
 public void SetTextureOffset2(Vector2 offset, RageSpline caller)
 {
     if (this.textureOffset2 != offset)
     {
         this.textureOffset2 = offset;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
Ejemplo n.º 13
0
 public void SetTextureAngle2Deg(float angle, RageSpline caller)
 {
     if (this.textureAngle2 != angle)
     {
         this.textureAngle2 = Mathf.Clamp(angle, 0f, 360f);
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
Ejemplo n.º 14
0
 public void SetGradientScaleInv(float scale, RageSpline caller)
 {
     if (this.gradientScale != scale)
     {
         this.gradientScale = Mathf.Clamp(scale, 0.00001f, 100f);
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
Ejemplo n.º 15
0
 public void SetGradientAngleDeg(float angle, RageSpline caller)
 {
     if (this.gradientAngle != angle)
     {
         this.gradientAngle = Mathf.Clamp(angle, 0f, 360f);
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
Ejemplo n.º 16
0
 public void SetGradientOffset(Vector2 offset, RageSpline caller)
 {
     if (this.gradientOffset != offset)
     {
         this.gradientOffset = offset;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
Ejemplo n.º 17
0
 public void SetPhysicsMaterial(PhysicMaterial physicsMaterial, RageSpline caller)
 {
     if (this.physicsMaterial != physicsMaterial)
     {
         this.physicsMaterial = physicsMaterial;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
Ejemplo n.º 18
0
 public void SetEmbossColor2(Color color, RageSpline caller)
 {
     if (this.embossColor2 != color)
     {
         this.embossColor2 = color;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
Ejemplo n.º 19
0
 public void SetVertexCount(int count, RageSpline caller)
 {
     if (this.vertexCount != count)
     {
         this.vertexCount = count;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
Ejemplo n.º 20
0
 public void SetEmbossAngle(float angle, RageSpline caller)
 {
     if (this.embossAngle != angle)
     {
         this.embossAngle = Mathf.Clamp(angle, 0f, 360f);
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
Ejemplo n.º 21
0
 public void SetCreateConvexMeshCollider(bool createConvexMeshCollider, RageSpline caller)
 {
     if (this.createConvexMeshCollider != createConvexMeshCollider)
     {
         this.createConvexMeshCollider = createConvexMeshCollider;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
Ejemplo n.º 22
0
 public void SetEmbossOffset(float offset, RageSpline caller)
 {
     if (this.embossOffset != offset)
     {
         this.embossOffset = offset;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
Ejemplo n.º 23
0
 public void SetBoxColliderDepth(float depth, RageSpline caller)
 {
     if (this.boxColliderDepth != depth)
     {
         this.boxColliderDepth = Mathf.Clamp(depth, 0.1f, 1000f);
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
Ejemplo n.º 24
0
 public void SetEmbossSize(float size, RageSpline caller)
 {
     if (this.embossSize != size)
     {
         this.embossSize = Mathf.Clamp(size, 0.00061f, 1000f);
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
Ejemplo n.º 25
0
 public void SetOutlineWidth(float width, RageSpline caller)
 {
     if (this.outlineWidth != width)
     {
         this.outlineWidth = Mathf.Clamp(width, 0.0001f, 1000f);
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
Ejemplo n.º 26
0
 public void SetEmbossSmoothness(float smoothness, RageSpline caller)
 {
     if (this.embossCurveSmoothness != smoothness)
     {
         this.embossCurveSmoothness = Mathf.Clamp(smoothness, 0f, 100f);
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
Ejemplo n.º 27
0
 public void SetOptimizeAngle(float angle, RageSpline caller)
 {
     if (this.optimizeAngle != angle)
     {
         this.optimizeAngle = angle;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
Ejemplo n.º 28
0
 public void SetFillColor1(Color color, RageSpline caller)
 {
     if (this.fillColor1 != color)
     {
         this.fillColor1 = color;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
Ejemplo n.º 29
0
 public void SetLandscapeBottomDepth(float landscapeBottomDepth, RageSpline caller)
 {
     if (this.landscapeBottomDepth != landscapeBottomDepth)
     {
         this.landscapeBottomDepth = landscapeBottomDepth;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
Ejemplo n.º 30
0
 public void SetTexturing2(RageSpline.UVMapping texturing, RageSpline caller)
 {
     if (this.UVMapping2 != texturing)
     {
         this.UVMapping2 = texturing;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
Ejemplo n.º 31
0
    public void selectNearestItem(Vector3 position)
    {
        float nearestItemDistance = 999999999f;
        RageSpline previousActiveControl = activeControl;

        // Iterate all the GUI controls and find out which is the closest
        for (int index = 0; index < rageSpline.GetPointCount(); index++)
        {
            if ((controlPoints[index].transform.position - position).magnitude < nearestItemDistance)
            {
                nearestItemDistance = (controlPoints[index].transform.position - position).magnitude;
                activeControlPointIndex = index;
                activeControlType = ControlType.Point;
                activeControl = controlPoints[index];
            }
            if ((inControlPoints[index].transform.position - position).magnitude < nearestItemDistance)
            {
                nearestItemDistance = (inControlPoints[index].transform.position - position).magnitude;
                activeControlPointIndex = index;
                activeControlType = ControlType.InCtrl;
                activeControl = inControlPoints[index];
            }
            if ((outControlPoints[index].transform.position - position).magnitude < nearestItemDistance)
            {
                nearestItemDistance = (outControlPoints[index].transform.position - position).magnitude;
                activeControlPointIndex = index;
                activeControlType = ControlType.OutCtrl;
                activeControl = outControlPoints[index];
            }
        }

        // Check if the closest is near enough
        if (nearestItemDistance > maxSelectionRange)
        {
            activeControl = null;
            activeControlPointIndex = -1;
            activeControlType = ControlType.NotSelected;
        }

        // Did the selected control change?
        if (previousActiveControl != activeControl)
        {
            // Reset the previously selected control to unselected color
            if(previousActiveControl!=null) {
                previousActiveControl.SetFillColor1(unSelectedColor);
                previousActiveControl.RefreshMesh();
            }
            // Fill the newly selected control with selectedColor
            if (activeControl != null)
            {
                activeControl.SetFillColor1(selectedColor);
                activeControl.RefreshMesh();
            }
        }
    }
Ejemplo n.º 32
0
 public void SetVertexCount(int count, RageSpline caller)
 {
     if (this.vertexCount != count)
     {
         this.vertexCount = count;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
Ejemplo n.º 33
0
 public void SetTextureScaleInv(float scale, RageSpline caller)
 {
     if (this.textureScale != scale)
     {
         this.textureScale = Mathf.Clamp(scale, 0.00001f, 100f);
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
Ejemplo n.º 34
0
 public void SetTextureAngleDeg(float angle, RageSpline caller)
 {
     if (this.textureAngle != angle)
     {
         this.textureAngle = Mathf.Clamp(angle, 0f, 360f);
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
Ejemplo n.º 35
0
 public void SetPhysicsNormalOffset(float offset, RageSpline caller)
 {
     this.colliderNormalOffset = offset;
 }
Ejemplo n.º 36
0
 public void SetPhysicsColliderCount(int count, RageSpline caller)
 {
     if (this.physicsColliderCount != count)
     {
         this.physicsColliderCount = count;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
Ejemplo n.º 37
0
 public void SetOutlineWidth(float width, RageSpline caller)
 {
     if (this.outlineWidth != width)
     {
         this.outlineWidth = Mathf.Clamp(width, 0.0001f, 1000f);
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
Ejemplo n.º 38
0
 public void SetOutlineGradient(RageSpline.OutlineGradient outlineGradient, RageSpline caller)
 {
     if (this.outlineGradient != outlineGradient)
     {
         this.outlineGradient = outlineGradient;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
Ejemplo n.º 39
0
 public void SetEmbossSmoothness(float smoothness, RageSpline caller)
 {
     if (this.embossCurveSmoothness != smoothness)
     {
         this.embossCurveSmoothness = Mathf.Clamp(smoothness, 0f, 100f);
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
Ejemplo n.º 40
0
 public void SetEmbossSize(float size, RageSpline caller)
 {
     if (this.embossSize != size)
     {
         this.embossSize = Mathf.Clamp(size, 0.00061f, 1000f);
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
Ejemplo n.º 41
0
 public void SetEmbossOffset(float offset, RageSpline caller)
 {
     if (this.embossOffset != offset)
     {
         this.embossOffset = offset;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
Ejemplo n.º 42
0
 public void SetEmbossColor1(Color color, RageSpline caller)
 {
     if (this.embossColor1 != color)
     {
         this.embossColor1 = color;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
Ejemplo n.º 43
0
 public void SetEmbossAngle(float angle, RageSpline caller)
 {
     if (this.embossAngle != angle)
     {
         this.embossAngle = Mathf.Clamp(angle, 0f, 360f);
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
Ejemplo n.º 44
0
 public void SetOutline(RageSpline.Outline outline, RageSpline caller)
 {
     if (this.outline != outline)
     {
         this.outline = outline;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
Ejemplo n.º 45
0
 public void SetOutlineColor2(Color color, RageSpline caller)
 {
     if (outlineColor2 != color)
     {
         this.outlineColor2 = color;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
Ejemplo n.º 46
0
 public void SetFill(RageSpline.Fill fill, RageSpline caller)
 {
     if (this.fill != fill)
     {
         this.fill = fill;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
Ejemplo n.º 47
0
 public void SetOutlineNormalOffset(float outlineNormalOffset, RageSpline caller)
 {
     if (this.outlineNormalOffset != outlineNormalOffset)
     {
         this.outlineNormalOffset = outlineNormalOffset;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
Ejemplo n.º 48
0
 public void SetFillColor2(Color color, RageSpline caller)
 {
     if (this.fillColor2 != color)
     {
         this.fillColor2 = color;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
Ejemplo n.º 49
0
 public void SetPhysics(RageSpline.Physics physics, RageSpline caller)
 {
     if (this.physics != physics)
     {
         this.physics = physics;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
Ejemplo n.º 50
0
 public void SetGradientOffset(Vector2 offset, RageSpline caller)
 {
     if (this.gradientOffset != offset)
     {
         this.gradientOffset = offset;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
Ejemplo n.º 51
0
 public void SetPhysicsMaterial(PhysicMaterial physicsMaterial, RageSpline caller)
 {
     if (this.physicsMaterial != physicsMaterial)
     {
         this.physicsMaterial = physicsMaterial;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
Ejemplo n.º 52
0
 public void SetLandscapeBottomDepth(float landscapeBottomDepth, RageSpline caller)
 {
     if (this.landscapeBottomDepth != landscapeBottomDepth)
     {
         this.landscapeBottomDepth = landscapeBottomDepth;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
Ejemplo n.º 53
0
 public void SetPhysicsZDepth(float depth, RageSpline caller)
 {
     if (this.colliderZDepth != depth)
     {
         this.colliderZDepth = depth;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
Ejemplo n.º 54
0
    public void SetLandscapeOutlineAlign(float landscapeOutlineAlign, RageSpline caller)
    {
        landscapeOutlineAlign = Mathf.Clamp01(landscapeOutlineAlign);

        if (this.landscapeOutlineAlign != landscapeOutlineAlign)
        {
            this.landscapeOutlineAlign = landscapeOutlineAlign;
            RefreshAllRageSplinesWithThisStyle(caller);
        }
    }
Ejemplo n.º 55
0
 public void SetTextureOffset2(Vector2 offset, RageSpline caller)
 {
     if (this.textureOffset2 != offset)
     {
         this.textureOffset2 = offset;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
Ejemplo n.º 56
0
 public void SetOptimize(bool optimize, RageSpline caller)
 {
     if(this.optimize != optimize)
     {
         this.optimize = optimize;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
Ejemplo n.º 57
0
 public void SetTexturing2(RageSpline.UVMapping texturing, RageSpline caller)
 {
     if (this.UVMapping2 != texturing)
     {
         this.UVMapping2 = texturing;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
Ejemplo n.º 58
0
 public void SetOptimizeAngle(float angle, RageSpline caller)
 {
     if(this.optimizeAngle != angle)
     {
         this.optimizeAngle = angle;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
Ejemplo n.º 59
0
 public void SetCreatePhysicsInEditor(bool createInEditor, RageSpline caller)
 {
     if (this.createPhysicsInEditor != createInEditor)
     {
         this.createPhysicsInEditor = createInEditor;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
Ejemplo n.º 60
0
 public void SetEmboss(RageSpline.Emboss emboss, RageSpline caller)
 {
     if (this.emboss != emboss)
     {
         this.emboss = emboss;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }