diff --git a/IronToad_UnityProject/Assets/BansheeGz/BGCurve/Examples/Materials/BGTestLineRendererCheckerBox.mat b/IronToad_UnityProject/Assets/BansheeGz/BGCurve/Examples/Materials/BGTestLineRendererCheckerBox.mat index a8d90bb..7eb7c60 100644 Binary files a/IronToad_UnityProject/Assets/BansheeGz/BGCurve/Examples/Materials/BGTestLineRendererCheckerBox.mat and b/IronToad_UnityProject/Assets/BansheeGz/BGCurve/Examples/Materials/BGTestLineRendererCheckerBox.mat differ diff --git a/IronToad_UnityProject/Assets/Lighthouse.cs b/IronToad_UnityProject/Assets/Lighthouse.cs new file mode 100644 index 0000000..cd388a2 --- /dev/null +++ b/IronToad_UnityProject/Assets/Lighthouse.cs @@ -0,0 +1,56 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +using BansheeGz.BGSpline.Components; +using BansheeGz.BGSpline.Curve; + +public class Lighthouse : MonoBehaviour +{ + public BGCurve splineCurve; + public List splineDistantPoints = new List(); + public float speed = 200f; + public float timePadding = 0.5f; + public float timeBetweenPoints = 3f; + + private BGCcCursor splineCursor; + private int targetPoint = 0; + private bool reverseDirection = false; + + void Start() + { + splineCursor = splineCurve.GetComponent(); + + moveToNextPoint(); + } + + public void moveToNextPoint() + { + LeanTween.delayedCall(gameObject, timeBetweenPoints, ()=>{ + if (reverseDirection) + targetPoint--; + else + targetPoint++; + if (targetPoint >= splineDistantPoints.Count) + { + if (splineCurve.Closed) + { + targetPoint = 1; + splineCursor.Distance = 0f; + } + else + { + targetPoint = splineDistantPoints.Count - 2; + reverseDirection = !reverseDirection; + } + } + + float start = splineCursor.Distance; + float end = splineDistantPoints[targetPoint]; + float distance = Mathf.Abs(end - start); + LeanTween.value(gameObject, start, end, distance / speed + timePadding).setOnUpdate((float val)=>{ + splineCursor.Distance = val; + }).setEaseInOutQuad().setOnComplete(moveToNextPoint); + }); + } +} diff --git a/IronToad_UnityProject/Assets/Lighthouse.cs.meta b/IronToad_UnityProject/Assets/Lighthouse.cs.meta new file mode 100644 index 0000000..c35ad1b --- /dev/null +++ b/IronToad_UnityProject/Assets/Lighthouse.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: e529d146693e04d5983a4fbbb25de5ab +timeCreated: 1484975905 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/IronToad_UnityProject/Assets/Materials/No Name.mat b/IronToad_UnityProject/Assets/Materials/No Name.mat index e15f536..458f8a4 100644 Binary files a/IronToad_UnityProject/Assets/Materials/No Name.mat and b/IronToad_UnityProject/Assets/Materials/No Name.mat differ diff --git a/IronToad_UnityProject/Assets/Models.meta b/IronToad_UnityProject/Assets/Models.meta new file mode 100644 index 0000000..cd0e4cf --- /dev/null +++ b/IronToad_UnityProject/Assets/Models.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: dc40a5a63cf904fd5b676a47e405c742 +folderAsset: yes +timeCreated: 1484970039 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/IronToad_UnityProject/Assets/Sound.meta b/IronToad_UnityProject/Assets/Sound.meta new file mode 100644 index 0000000..c6dafb0 --- /dev/null +++ b/IronToad_UnityProject/Assets/Sound.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 0fbabcae9313543ffbf1429aeac3664d +folderAsset: yes +timeCreated: 1484963877 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/IronToad_UnityProject/Assets/_Scenes/LighthouseTestScene.unity b/IronToad_UnityProject/Assets/_Scenes/LighthouseTestScene.unity new file mode 100644 index 0000000..1ed7339 Binary files /dev/null and b/IronToad_UnityProject/Assets/_Scenes/LighthouseTestScene.unity differ diff --git a/IronToad_UnityProject/Assets/_Scenes/LighthouseTestScene.unity.meta b/IronToad_UnityProject/Assets/_Scenes/LighthouseTestScene.unity.meta new file mode 100644 index 0000000..1424c0d --- /dev/null +++ b/IronToad_UnityProject/Assets/_Scenes/LighthouseTestScene.unity.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4c20f98c0786f41f7b817e6e904f0926 +timeCreated: 1484970007 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: