static public int point(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif LTBezier self = (LTBezier)checkSelf(l); System.Single a1; checkType(l, 2, out a1); var ret = self.point(a1); pushValue(l, true); pushValue(l, ret); return(2); } catch (Exception e) { return(error(l, e)); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif }
IEnumerator ParticlePath(float duration, float delay) { Color c = Target.Color; Color originalColor = new Color(c.r, c.g, c.b, c.a); Color originalNoAlpha = new Color(c.r, c.g, c.b, 0f); Vector3 originalScale = Vector3.one * 0.5f * 0.25f; Vector3 startScale = originalScale * 0.25f; yield return(new WaitForSeconds(delay)); for (int i = 0; i < 30; i++) { GameObject arrow = Instantiate(ParticlePrefab, transform.position, transform.rotation); RectTransform rect = arrow.transform.Find("Canvas/Arrow").GetComponent <RectTransform>(); Image image = arrow.transform.Find("Canvas/Arrow").GetComponent <Image>(); image.color = originalNoAlpha; LeanTween.color(rect, originalColor, 0.3f).setEase(LeanTweenType.easeInOutSine); arrow.transform.localScale = startScale; LeanTween.scale(arrow, originalScale, 2f).setEase(LeanTweenType.easeInSine); arrow.transform.LookAt(transform.position + transform.up); LeanTween.value(arrow, 0f, 1f, 5f).setOnUpdate((float val) => { Vector3 pos = bezierPath.point(val); Vector3 next = bezierPath.point(val + 0.05f); arrow.transform.position = pos; arrow.transform.LookAt(next); }).setOnComplete(() => { Destroy(arrow); }).setEase(LeanTweenType.easeInSine); yield return(new WaitForSeconds(duration / 30f)); } }
static public int point(IntPtr l) { try { LTBezier self = (LTBezier)checkSelf(l); System.Single a1; checkType(l, 2, out a1); var ret = self.point(a1); pushValue(l, true); pushValue(l, ret); return(2); } catch (Exception e) { return(error(l, e)); } }
static public int point(IntPtr l) { try { LTBezier self = (LTBezier)checkSelf(l); System.Single a1; checkType(l, 2, out a1); var ret = self.point(a1); pushValue(l, ret); return(1); } catch (Exception e) { LuaDLL.luaL_error(l, e.ToString()); return(0); } }
static int point(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); LTBezier obj = (LTBezier)ToLua.CheckObject(L, 1, typeof(LTBezier)); float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); UnityEngine.Vector3 o = obj.point(arg0); ToLua.Push(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
public void UpdateBezierPathEnd(Vector3 newPosition) { if (newPosition == P3) { return; } P3 = newPosition; P2 = P3 + ((P0 - P3).normalized * P2Magnitude); bezierPath = new LTBezier(P0, P1, P2, P3, 1f); for (int i = 0; i < steps; i++) { pointList[i] = bezierPath.point(stepList[i]); } }
public void UpdateBezierPathStart(Vector3 newPosition, Vector3 newForward) { if (newPosition == P0 && newForward == previousPathForward) { return; } P0 = newPosition; P1 = P0 + (newForward * P1Magnitude); bezierPath = new LTBezier(P0, P1, P2, P3, 1f); for (int i = 0; i < steps; i++) { pointList[i] = bezierPath.point(stepList[i]); } previousPathForward = newForward; }
public void CreatePathToObject(GameObject to, float duration, float delay) { pointList = new Vector3[steps]; Vector3 start = transform.position; Vector3 end = to.transform.position; Vector3 forward = transform.up; previousPathForward = forward; P0 = start; P1 = P0 + (forward * P1Magnitude); P3 = end; P2 = P3 + ((P0 - P3).normalized * P2Magnitude); bezierPath = new LTBezier(P0, P1, P2, P3, 1f); for (int i = 0; i < steps; i++) { pointList[i] = bezierPath.point(stepList[i]); } StartCoroutine(ParticlePath(duration, delay)); }