更改文件架构
This commit is contained in:
17
Packages/Common~/Scripts/Renderer/BITKit.Renderer.asmdef
Normal file
17
Packages/Common~/Scripts/Renderer/BITKit.Renderer.asmdef
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "BITKit.Renderer",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:14fe60d984bf9f84eac55c6ea033a8f4",
|
||||
"GUID:9400d40641bab5b4a9702f65bf5c6eb5"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 48c71d5238544f149b295cc40e244719
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
36
Packages/Common~/Scripts/Renderer/LineConnector.cs
Normal file
36
Packages/Common~/Scripts/Renderer/LineConnector.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Pool;
|
||||
namespace BITKit
|
||||
{
|
||||
[ExecuteAlways]
|
||||
public class LineConnector : MonoBehaviour
|
||||
{
|
||||
public LineRenderer lineRenderer;
|
||||
public Transform[] points;
|
||||
public float radius = 0.64f;
|
||||
public int excuteTimes;
|
||||
void Update()
|
||||
{
|
||||
if (lineRenderer && points.Length > 0)
|
||||
{
|
||||
var list = ListPool<Vector3>.Get();
|
||||
var currentPosition = points[0].position;
|
||||
list.Add(currentPosition);
|
||||
foreach (var point in points)
|
||||
{
|
||||
if (Vector3.Distance(point.position, currentPosition) >= radius)
|
||||
{
|
||||
list.Add(currentPosition = point.position);
|
||||
}
|
||||
//list.Add(point.position);
|
||||
}
|
||||
lineRenderer.positionCount =list.Count;
|
||||
lineRenderer.SetPositions(list.ToArray());
|
||||
ListPool<Vector3>.Release(list);
|
||||
excuteTimes++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
11
Packages/Common~/Scripts/Renderer/LineConnector.cs.meta
Normal file
11
Packages/Common~/Scripts/Renderer/LineConnector.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 69ef16681d6f34d4d9ccc4200c8e2471
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user