Remove Curved Line package
This commit is contained in:
parent
ecd9ad491d
commit
0cfb60bea0
@ -1,8 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: c5dd104aa5d6bff4d972bb36ad0340ab
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@ -1,8 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 64f5b1a0bb6688d498ff44bbae7b57a5
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@ -1,30 +0,0 @@
|
|||||||
using UnityEngine;
|
|
||||||
using System.Collections;
|
|
||||||
|
|
||||||
public class CurvedLinePoint : MonoBehaviour
|
|
||||||
{
|
|
||||||
[HideInInspector] public bool showGizmo = true;
|
|
||||||
[HideInInspector] public float gizmoSize = 0.1f;
|
|
||||||
[HideInInspector] public Color gizmoColor = new Color(1,0,0,0.5f);
|
|
||||||
|
|
||||||
void OnDrawGizmos()
|
|
||||||
{
|
|
||||||
if( showGizmo == true )
|
|
||||||
{
|
|
||||||
Gizmos.color = gizmoColor;
|
|
||||||
|
|
||||||
Gizmos.DrawSphere( this.transform.position, gizmoSize );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//update parent line when this point moved
|
|
||||||
void OnDrawGizmosSelected()
|
|
||||||
{
|
|
||||||
CurvedLineRenderer curvedLine = this.transform.parent.GetComponent<CurvedLineRenderer>();
|
|
||||||
|
|
||||||
if( curvedLine != null )
|
|
||||||
{
|
|
||||||
curvedLine.Update();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 4efb4faa31cad924994c5bc6ba7329d7
|
|
||||||
timeCreated: 1457753586
|
|
||||||
licenseType: Free
|
|
||||||
MonoImporter:
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@ -1,94 +0,0 @@
|
|||||||
using UnityEngine;
|
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
[RequireComponent( typeof(LineRenderer) )]
|
|
||||||
public class CurvedLineRenderer : MonoBehaviour
|
|
||||||
{
|
|
||||||
//PUBLIC
|
|
||||||
public float lineSegmentSize = 0.15f;
|
|
||||||
public float lineWidth = 0.1f;
|
|
||||||
[Header("Gizmos")]
|
|
||||||
public bool showGizmos = true;
|
|
||||||
public float gizmoSize = 0.1f;
|
|
||||||
public Color gizmoColor = new Color(1,0,0,0.5f);
|
|
||||||
//PRIVATE
|
|
||||||
private CurvedLinePoint[] linePoints = new CurvedLinePoint[0];
|
|
||||||
private Vector3[] linePositions = new Vector3[0];
|
|
||||||
private Vector3[] linePositionsOld = new Vector3[0];
|
|
||||||
|
|
||||||
// Update is called once per frame
|
|
||||||
public void Update ()
|
|
||||||
{
|
|
||||||
GetPoints();
|
|
||||||
SetPointsToLine();
|
|
||||||
}
|
|
||||||
|
|
||||||
void GetPoints()
|
|
||||||
{
|
|
||||||
//find curved points in children
|
|
||||||
linePoints = this.GetComponentsInChildren<CurvedLinePoint>();
|
|
||||||
|
|
||||||
//add positions
|
|
||||||
linePositions = new Vector3[linePoints.Length];
|
|
||||||
for( int i = 0; i < linePoints.Length; i++ )
|
|
||||||
{
|
|
||||||
linePositions[i] = linePoints[i].transform.position;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetPointsToLine()
|
|
||||||
{
|
|
||||||
//create old positions if they dont match
|
|
||||||
if( linePositionsOld.Length != linePositions.Length )
|
|
||||||
{
|
|
||||||
linePositionsOld = new Vector3[linePositions.Length];
|
|
||||||
}
|
|
||||||
|
|
||||||
//check if line points have moved
|
|
||||||
bool moved = false;
|
|
||||||
for( int i = 0; i < linePositions.Length; i++ )
|
|
||||||
{
|
|
||||||
//compare
|
|
||||||
if( linePositions[i] != linePositionsOld[i] )
|
|
||||||
{
|
|
||||||
moved = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//update if moved
|
|
||||||
if( moved == true )
|
|
||||||
{
|
|
||||||
LineRenderer line = this.GetComponent<LineRenderer>();
|
|
||||||
|
|
||||||
//get smoothed values
|
|
||||||
Vector3[] smoothedPoints = LineSmoother.SmoothLine( linePositions, lineSegmentSize );
|
|
||||||
|
|
||||||
//set line settings
|
|
||||||
line.SetVertexCount( smoothedPoints.Length );
|
|
||||||
line.SetPositions( smoothedPoints );
|
|
||||||
line.SetWidth( lineWidth, lineWidth );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnDrawGizmosSelected()
|
|
||||||
{
|
|
||||||
Update();
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnDrawGizmos()
|
|
||||||
{
|
|
||||||
if( linePoints.Length == 0 )
|
|
||||||
{
|
|
||||||
GetPoints();
|
|
||||||
}
|
|
||||||
|
|
||||||
//settings for gizmos
|
|
||||||
foreach( CurvedLinePoint linePoint in linePoints )
|
|
||||||
{
|
|
||||||
linePoint.showGizmo = showGizmos;
|
|
||||||
linePoint.gizmoSize = gizmoSize;
|
|
||||||
linePoint.gizmoColor = gizmoColor;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: f886d860c5994de44bda0d51d3182bee
|
|
||||||
timeCreated: 1457752249
|
|
||||||
licenseType: Free
|
|
||||||
MonoImporter:
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
Binary file not shown.
@ -1,12 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: ac901715280af9641bef97a88e0a3522
|
|
||||||
timeCreated: 1457750910
|
|
||||||
licenseType: Free
|
|
||||||
MonoImporter:
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@ -1,8 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: ba19bde9a20962f488a50be7f354bc2e
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
File diff suppressed because it is too large
Load Diff
@ -1,8 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 7910d69941406d04294f7eb428513ad0
|
|
||||||
timeCreated: 1457754790
|
|
||||||
licenseType: Free
|
|
||||||
DefaultImporter:
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
Binary file not shown.
@ -1,8 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: c1b4e62fb04f0734d84710b9fbdd8c85
|
|
||||||
timeCreated: 1457756473
|
|
||||||
licenseType: Free
|
|
||||||
NativeFormatImporter:
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@ -1658,7 +1658,7 @@ PrefabInstance:
|
|||||||
- target: {fileID: 6829507564963703646, guid: 0f97dac5215d69a4795763340d82925d,
|
- target: {fileID: 6829507564963703646, guid: 0f97dac5215d69a4795763340d82925d,
|
||||||
type: 3}
|
type: 3}
|
||||||
propertyPath: m_Enabled
|
propertyPath: m_Enabled
|
||||||
value: 0
|
value: 1
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
m_RemovedComponents: []
|
m_RemovedComponents: []
|
||||||
m_SourcePrefab: {fileID: 100100000, guid: 0f97dac5215d69a4795763340d82925d, type: 3}
|
m_SourcePrefab: {fileID: 100100000, guid: 0f97dac5215d69a4795763340d82925d, type: 3}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user