Copy Aetheria Code
Added a bunch of code from the old Aetheria project
This commit is contained in:
parent
ab392cd3d6
commit
c58ba0b1da
1704 changed files with 175081 additions and 313 deletions
|
|
@ -0,0 +1,78 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace UnityEngine.UI.Extensions.Examples
|
||||
{
|
||||
[RequireComponent(typeof(UILineRenderer))]
|
||||
public class LineRendererOrbit : MonoBehaviour
|
||||
{
|
||||
UILineRenderer lr;
|
||||
Circle circle;
|
||||
public GameObject OrbitGO;
|
||||
RectTransform orbitGOrt;
|
||||
float orbitTime;
|
||||
|
||||
[SerializeField]
|
||||
private float _xAxis = 3;
|
||||
|
||||
public float xAxis
|
||||
{
|
||||
get { return _xAxis; }
|
||||
set { _xAxis = value; GenerateOrbit(); }
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
private float _yAxis = 3;
|
||||
|
||||
public float yAxis
|
||||
{
|
||||
get { return _yAxis; }
|
||||
set { _yAxis = value; GenerateOrbit(); }
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
private int _steps = 10;
|
||||
|
||||
public int Steps
|
||||
{
|
||||
get { return _steps; }
|
||||
set { _steps = value; GenerateOrbit(); }
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Use this for initialization
|
||||
void Awake()
|
||||
{
|
||||
lr = GetComponent<UILineRenderer>();
|
||||
orbitGOrt = OrbitGO.GetComponent<RectTransform>();
|
||||
GenerateOrbit();
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
orbitTime = orbitTime > _steps ? orbitTime = 0 : orbitTime + Time.deltaTime;
|
||||
orbitGOrt.localPosition = circle.Evaluate(orbitTime);
|
||||
}
|
||||
|
||||
void GenerateOrbit()
|
||||
{
|
||||
circle = new Circle(xAxis: _xAxis, yAxis: _yAxis, steps: _steps);
|
||||
List<Vector2> Points = new List<Vector2>();
|
||||
for (int i = 0; i < _steps; i++)
|
||||
{
|
||||
Points.Add(circle.Evaluate(i));
|
||||
}
|
||||
Points.Add(circle.Evaluate(0));
|
||||
lr.Points = Points.ToArray();
|
||||
}
|
||||
|
||||
private void OnValidate()
|
||||
{
|
||||
if (lr != null)
|
||||
{
|
||||
GenerateOrbit();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 544c2baa26170b34fb34c19cb04b1fb1
|
||||
timeCreated: 1498381316
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace UnityEngine.UI.Extensions.Examples
|
||||
{
|
||||
public class TestAddingPoints : MonoBehaviour
|
||||
{
|
||||
public UILineRenderer LineRenderer;
|
||||
public Text XValue;
|
||||
public Text YValue;
|
||||
|
||||
// Use this for initialization
|
||||
public void AddNewPoint()
|
||||
{
|
||||
var point = new Vector2() { x = float.Parse(XValue.text), y = float.Parse(YValue.text) };
|
||||
var pointlist = new List<Vector2>(LineRenderer.Points);
|
||||
pointlist.Add(point);
|
||||
LineRenderer.Points = pointlist.ToArray();
|
||||
}
|
||||
|
||||
public void ClearPoints()
|
||||
{
|
||||
LineRenderer.Points = new Vector2[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 6f7b10baa6c50634a979160a8c4f142c
|
||||
timeCreated: 1463340207
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: b01f9e610467c714c9077cf2622eb7b2
|
||||
timeCreated: 1464634788
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Loading…
Reference in a new issue