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.");
    }
示例#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);
        }
 public void SetCreatePhysicsInEditor(bool createInEditor, RageSpline caller)
 {
     if (this.createPhysicsInEditor != createInEditor)
     {
         this.createPhysicsInEditor = createInEditor;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
 public void SetOptimize(bool optimize, RageSpline caller)
 {
     if (this.optimize != optimize)
     {
         this.optimize = optimize;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
 public void SetPhysics(RageSpline.Physics physics, RageSpline caller)
 {
     if (this.physics != physics)
     {
         this.physics = physics;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
 public void SetAntialiasingWidth(float width, RageSpline caller)
 {
     if (this.antiAliasingWidth != width)
     {
         this.antiAliasingWidth = Mathf.Clamp(width, 0f, 1000f);
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
 public void SetOutlineTexturingScaleInv(float scale, RageSpline caller)
 {
     if (this.outlineTexturingScale != scale)
     {
         this.outlineTexturingScale = Mathf.Clamp(scale, 0.001f, 1000f);
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
 public void SetPhysicsColliderCount(int count, RageSpline caller)
 {
     if (this.physicsColliderCount != count)
     {
         this.physicsColliderCount = count;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
 public void SetPhysicsZDepth(float depth, RageSpline caller)
 {
     if (this.colliderZDepth != depth)
     {
         this.colliderZDepth = depth;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
 public void SetTextureScale2Inv(float scale, RageSpline caller)
 {
     if (this.textureScale2 != scale)
     {
         this.textureScale2 = Mathf.Clamp(scale, 0.00001f, 100f);
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
 public void SetEmboss(RageSpline.Emboss emboss, RageSpline caller)
 {
     if (this.emboss != emboss)
     {
         this.emboss = emboss;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
 public void SetTextureOffset2(Vector2 offset, RageSpline caller)
 {
     if (this.textureOffset2 != offset)
     {
         this.textureOffset2 = offset;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
 public void SetTextureAngle2Deg(float angle, RageSpline caller)
 {
     if (this.textureAngle2 != angle)
     {
         this.textureAngle2 = Mathf.Clamp(angle, 0f, 360f);
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
 public void SetGradientScaleInv(float scale, RageSpline caller)
 {
     if (this.gradientScale != scale)
     {
         this.gradientScale = Mathf.Clamp(scale, 0.00001f, 100f);
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
 public void SetGradientAngleDeg(float angle, RageSpline caller)
 {
     if (this.gradientAngle != angle)
     {
         this.gradientAngle = Mathf.Clamp(angle, 0f, 360f);
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
 public void SetGradientOffset(Vector2 offset, RageSpline caller)
 {
     if (this.gradientOffset != offset)
     {
         this.gradientOffset = offset;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
 public void SetPhysicsMaterial(PhysicMaterial physicsMaterial, RageSpline caller)
 {
     if (this.physicsMaterial != physicsMaterial)
     {
         this.physicsMaterial = physicsMaterial;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
 public void SetEmbossColor2(Color color, RageSpline caller)
 {
     if (this.embossColor2 != color)
     {
         this.embossColor2 = color;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
 public void SetVertexCount(int count, RageSpline caller)
 {
     if (this.vertexCount != count)
     {
         this.vertexCount = count;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
 public void SetEmbossAngle(float angle, RageSpline caller)
 {
     if (this.embossAngle != angle)
     {
         this.embossAngle = Mathf.Clamp(angle, 0f, 360f);
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
 public void SetCreateConvexMeshCollider(bool createConvexMeshCollider, RageSpline caller)
 {
     if (this.createConvexMeshCollider != createConvexMeshCollider)
     {
         this.createConvexMeshCollider = createConvexMeshCollider;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
 public void SetEmbossOffset(float offset, RageSpline caller)
 {
     if (this.embossOffset != offset)
     {
         this.embossOffset = offset;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
 public void SetBoxColliderDepth(float depth, RageSpline caller)
 {
     if (this.boxColliderDepth != depth)
     {
         this.boxColliderDepth = Mathf.Clamp(depth, 0.1f, 1000f);
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
 public void SetEmbossSize(float size, RageSpline caller)
 {
     if (this.embossSize != size)
     {
         this.embossSize = Mathf.Clamp(size, 0.00061f, 1000f);
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
 public void SetOutlineWidth(float width, RageSpline caller)
 {
     if (this.outlineWidth != width)
     {
         this.outlineWidth = Mathf.Clamp(width, 0.0001f, 1000f);
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
 public void SetEmbossSmoothness(float smoothness, RageSpline caller)
 {
     if (this.embossCurveSmoothness != smoothness)
     {
         this.embossCurveSmoothness = Mathf.Clamp(smoothness, 0f, 100f);
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
 public void SetOptimizeAngle(float angle, RageSpline caller)
 {
     if (this.optimizeAngle != angle)
     {
         this.optimizeAngle = angle;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
 public void SetFillColor1(Color color, RageSpline caller)
 {
     if (this.fillColor1 != color)
     {
         this.fillColor1 = color;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
 public void SetLandscapeBottomDepth(float landscapeBottomDepth, RageSpline caller)
 {
     if (this.landscapeBottomDepth != landscapeBottomDepth)
     {
         this.landscapeBottomDepth = landscapeBottomDepth;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
 public void SetTexturing2(RageSpline.UVMapping texturing, RageSpline caller)
 {
     if (this.UVMapping2 != texturing)
     {
         this.UVMapping2 = texturing;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
示例#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();
            }
        }
    }
示例#32
0
 public void SetVertexCount(int count, RageSpline caller)
 {
     if (this.vertexCount != count)
     {
         this.vertexCount = count;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
示例#33
0
 public void SetTextureScaleInv(float scale, RageSpline caller)
 {
     if (this.textureScale != scale)
     {
         this.textureScale = Mathf.Clamp(scale, 0.00001f, 100f);
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
示例#34
0
 public void SetTextureAngleDeg(float angle, RageSpline caller)
 {
     if (this.textureAngle != angle)
     {
         this.textureAngle = Mathf.Clamp(angle, 0f, 360f);
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
示例#35
0
 public void SetPhysicsNormalOffset(float offset, RageSpline caller)
 {
     this.colliderNormalOffset = offset;
 }
示例#36
0
 public void SetPhysicsColliderCount(int count, RageSpline caller)
 {
     if (this.physicsColliderCount != count)
     {
         this.physicsColliderCount = count;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
示例#37
0
 public void SetOutlineWidth(float width, RageSpline caller)
 {
     if (this.outlineWidth != width)
     {
         this.outlineWidth = Mathf.Clamp(width, 0.0001f, 1000f);
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
示例#38
0
 public void SetOutlineGradient(RageSpline.OutlineGradient outlineGradient, RageSpline caller)
 {
     if (this.outlineGradient != outlineGradient)
     {
         this.outlineGradient = outlineGradient;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
示例#39
0
 public void SetEmbossSmoothness(float smoothness, RageSpline caller)
 {
     if (this.embossCurveSmoothness != smoothness)
     {
         this.embossCurveSmoothness = Mathf.Clamp(smoothness, 0f, 100f);
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
示例#40
0
 public void SetEmbossSize(float size, RageSpline caller)
 {
     if (this.embossSize != size)
     {
         this.embossSize = Mathf.Clamp(size, 0.00061f, 1000f);
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
示例#41
0
 public void SetEmbossOffset(float offset, RageSpline caller)
 {
     if (this.embossOffset != offset)
     {
         this.embossOffset = offset;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
示例#42
0
 public void SetEmbossColor1(Color color, RageSpline caller)
 {
     if (this.embossColor1 != color)
     {
         this.embossColor1 = color;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
示例#43
0
 public void SetEmbossAngle(float angle, RageSpline caller)
 {
     if (this.embossAngle != angle)
     {
         this.embossAngle = Mathf.Clamp(angle, 0f, 360f);
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
示例#44
0
 public void SetOutline(RageSpline.Outline outline, RageSpline caller)
 {
     if (this.outline != outline)
     {
         this.outline = outline;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
示例#45
0
 public void SetOutlineColor2(Color color, RageSpline caller)
 {
     if (outlineColor2 != color)
     {
         this.outlineColor2 = color;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
示例#46
0
 public void SetFill(RageSpline.Fill fill, RageSpline caller)
 {
     if (this.fill != fill)
     {
         this.fill = fill;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
示例#47
0
 public void SetOutlineNormalOffset(float outlineNormalOffset, RageSpline caller)
 {
     if (this.outlineNormalOffset != outlineNormalOffset)
     {
         this.outlineNormalOffset = outlineNormalOffset;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
示例#48
0
 public void SetFillColor2(Color color, RageSpline caller)
 {
     if (this.fillColor2 != color)
     {
         this.fillColor2 = color;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
示例#49
0
 public void SetPhysics(RageSpline.Physics physics, RageSpline caller)
 {
     if (this.physics != physics)
     {
         this.physics = physics;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
示例#50
0
 public void SetGradientOffset(Vector2 offset, RageSpline caller)
 {
     if (this.gradientOffset != offset)
     {
         this.gradientOffset = offset;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
示例#51
0
 public void SetPhysicsMaterial(PhysicMaterial physicsMaterial, RageSpline caller)
 {
     if (this.physicsMaterial != physicsMaterial)
     {
         this.physicsMaterial = physicsMaterial;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
示例#52
0
 public void SetLandscapeBottomDepth(float landscapeBottomDepth, RageSpline caller)
 {
     if (this.landscapeBottomDepth != landscapeBottomDepth)
     {
         this.landscapeBottomDepth = landscapeBottomDepth;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
示例#53
0
 public void SetPhysicsZDepth(float depth, RageSpline caller)
 {
     if (this.colliderZDepth != depth)
     {
         this.colliderZDepth = depth;
         RefreshAllRageSplinesWithThisStyle(caller);
     }
 }
示例#54
0
    public void SetLandscapeOutlineAlign(float landscapeOutlineAlign, RageSpline caller)
    {
        landscapeOutlineAlign = Mathf.Clamp01(landscapeOutlineAlign);

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