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."); }
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); } }
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(); } } }
public void SetTextureScaleInv(float scale, RageSpline caller) { if (this.textureScale != scale) { this.textureScale = Mathf.Clamp(scale, 0.00001f, 100f); RefreshAllRageSplinesWithThisStyle(caller); } }
public void SetTextureAngleDeg(float angle, RageSpline caller) { if (this.textureAngle != angle) { this.textureAngle = Mathf.Clamp(angle, 0f, 360f); RefreshAllRageSplinesWithThisStyle(caller); } }
public void SetPhysicsNormalOffset(float offset, RageSpline caller) { this.colliderNormalOffset = offset; }
public void SetOutlineGradient(RageSpline.OutlineGradient outlineGradient, RageSpline caller) { if (this.outlineGradient != outlineGradient) { this.outlineGradient = outlineGradient; RefreshAllRageSplinesWithThisStyle(caller); } }
public void SetEmbossColor1(Color color, RageSpline caller) { if (this.embossColor1 != color) { this.embossColor1 = color; RefreshAllRageSplinesWithThisStyle(caller); } }
public void SetOutline(RageSpline.Outline outline, RageSpline caller) { if (this.outline != outline) { this.outline = outline; RefreshAllRageSplinesWithThisStyle(caller); } }
public void SetOutlineColor2(Color color, RageSpline caller) { if (outlineColor2 != color) { this.outlineColor2 = color; RefreshAllRageSplinesWithThisStyle(caller); } }
public void SetFill(RageSpline.Fill fill, RageSpline caller) { if (this.fill != fill) { this.fill = fill; RefreshAllRageSplinesWithThisStyle(caller); } }
public void SetOutlineNormalOffset(float outlineNormalOffset, RageSpline caller) { if (this.outlineNormalOffset != outlineNormalOffset) { this.outlineNormalOffset = outlineNormalOffset; RefreshAllRageSplinesWithThisStyle(caller); } }
public void SetFillColor2(Color color, RageSpline caller) { if (this.fillColor2 != color) { this.fillColor2 = color; RefreshAllRageSplinesWithThisStyle(caller); } }
public void SetLandscapeOutlineAlign(float landscapeOutlineAlign, RageSpline caller) { landscapeOutlineAlign = Mathf.Clamp01(landscapeOutlineAlign); if (this.landscapeOutlineAlign != landscapeOutlineAlign) { this.landscapeOutlineAlign = landscapeOutlineAlign; RefreshAllRageSplinesWithThisStyle(caller); } }
public void SetOptimize(bool optimize, RageSpline caller) { if(this.optimize != optimize) { this.optimize = optimize; RefreshAllRageSplinesWithThisStyle(caller); } }
public void SetOptimizeAngle(float angle, RageSpline caller) { if(this.optimizeAngle != angle) { this.optimizeAngle = angle; RefreshAllRageSplinesWithThisStyle(caller); } }