Example #1
0
    static int _CreateLTBezier(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 5)
            {
                UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1);
                UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2);
                UnityEngine.Vector3 arg2 = ToLua.ToVector3(L, 3);
                UnityEngine.Vector3 arg3 = ToLua.ToVector3(L, 4);
                float    arg4            = (float)LuaDLL.luaL_checknumber(L, 5);
                LTBezier obj             = new LTBezier(arg0, arg1, arg2, arg3, arg4);
                ToLua.PushObject(L, obj);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to ctor method: LTBezier.New"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Example #2
0
    public void setPoints(Vector3[] pts_)
    {
        if (pts_.Length < 4)
        {
            LeanTween.logError("LeanTween - When passing values for a vector path, you must pass four or more values!");
        }
        if (pts_.Length % 4 != 0)
        {
            LeanTween.logError("LeanTween - When passing values for a vector path, they must be in sets of four: controlPoint1, controlPoint2, endPoint2, controlPoint2, controlPoint2...");
        }
        pts = pts_;
        int num = 0;

        beziers     = new LTBezier[pts.Length / 4];
        lengthRatio = new float[beziers.Length];
        length      = 0f;
        for (int i = 0; i < pts.Length; i += 4)
        {
            beziers[num] = new LTBezier(pts[i], pts[i + 2], pts[i + 1], pts[i + 3], 0.05f);
            length      += beziers[num].length;
            num++;
        }
        for (int i = 0; i < beziers.Length; i++)
        {
            lengthRatio[i] = beziers[i].length / length;
        }
    }
Example #3
0
 static public int get_length(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);
         pushValue(l, true);
         pushValue(l, self.length);
         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
 }
Example #4
0
	static int _CreateLTBezier(IntPtr L)
	{
		try
		{
			int count = LuaDLL.lua_gettop(L);

			if (count == 5)
			{
				UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1);
				UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2);
				UnityEngine.Vector3 arg2 = ToLua.ToVector3(L, 3);
				UnityEngine.Vector3 arg3 = ToLua.ToVector3(L, 4);
				float arg4 = (float)LuaDLL.luaL_checknumber(L, 5);
				LTBezier obj = new LTBezier(arg0, arg1, arg2, arg3, arg4);
				ToLua.PushObject(L, obj);
				return 1;
			}
			else
			{
				return LuaDLL.luaL_throw(L, "invalid arguments to ctor method: LTBezier.New");
			}
		}
		catch(Exception e)
		{
			return LuaDLL.toluaL_exception(L, e);
		}
	}
Example #5
0
 static public int get_length(IntPtr l)
 {
     try {
         LTBezier self = (LTBezier)checkSelf(l);
         pushValue(l, self.length);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
Example #6
0
 static public int get_length(IntPtr l)
 {
     try {
         LTBezier self = (LTBezier)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.length);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Example #7
0
 static public int set_length(IntPtr l)
 {
     try {
         LTBezier      self = (LTBezier)checkSelf(l);
         System.Single v;
         checkType(l, 2, out v);
         self.length = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Example #8
0
 static public int set_length(IntPtr l)
 {
     try {
         LTBezier      self = (LTBezier)checkSelf(l);
         System.Single v;
         checkType(l, 2, out v);
         self.length = v;
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
Example #9
0
 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));
     }
 }
Example #10
0
 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);
     }
 }
Example #11
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));
     }
 }
Example #12
0
    static int get_length(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            LTBezier obj = (LTBezier)o;
            float    ret = obj.length;
            LuaDLL.lua_pushnumber(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index length on a nil value" : e.Message));
        }
    }
Example #13
0
    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]);
        }
    }
Example #14
0
    static int set_length(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            LTBezier obj  = (LTBezier)o;
            float    arg0 = (float)LuaDLL.luaL_checknumber(L, 2);
            obj.length = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index length on a nil value" : e.Message));
        }
    }
Example #15
0
    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;
    }
Example #16
0
 static public int constructor(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            o;
         UnityEngine.Vector3 a1;
         checkType(l, 2, out a1);
         UnityEngine.Vector3 a2;
         checkType(l, 3, out a2);
         UnityEngine.Vector3 a3;
         checkType(l, 4, out a3);
         UnityEngine.Vector3 a4;
         checkType(l, 5, out a4);
         System.Single a5;
         checkType(l, 6, out a5);
         o = new LTBezier(a1, a2, a3, a4, a5);
         pushValue(l, true);
         pushValue(l, o);
         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
 }
Example #17
0
 public static int constructor(IntPtr l)
 {
     try {
         LTBezier o;
         UnityEngine.Vector3 a1;
         checkType(l,2,out a1);
         UnityEngine.Vector3 a2;
         checkType(l,3,out a2);
         UnityEngine.Vector3 a3;
         checkType(l,4,out a3);
         UnityEngine.Vector3 a4;
         checkType(l,5,out a4);
         System.Single a5;
         checkType(l,6,out a5);
         o=new LTBezier(a1,a2,a3,a4,a5);
         pushValue(l,o);
         return 1;
     }
     catch(Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return 0;
     }
 }
Example #18
0
 static public int constructor(IntPtr l)
 {
     try {
         LTBezier            o;
         UnityEngine.Vector3 a1;
         checkType(l, 2, out a1);
         UnityEngine.Vector3 a2;
         checkType(l, 3, out a2);
         UnityEngine.Vector3 a3;
         checkType(l, 4, out a3);
         UnityEngine.Vector3 a4;
         checkType(l, 5, out a4);
         System.Single a5;
         checkType(l, 6, out a5);
         o = new LTBezier(a1, a2, a3, a4, a5);
         pushValue(l, true);
         pushValue(l, o);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Example #19
0
    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));
    }
Example #20
0
    public void setPoints( Vector3[] pts_ )
    {
        if(pts_.Length<4)
            LeanTween.logError( "LeanTween - When passing values for a vector path, you must pass four or more values!" );
        if(pts_.Length%4!=0)
            LeanTween.logError( "LeanTween - When passing values for a vector path, they must be in sets of four: controlPoint1, controlPoint2, endPoint2, controlPoint2, controlPoint2..." );

        pts = pts_;

        int k = 0;
        beziers = new LTBezier[ pts.Length / 4 ];
        lengthRatio = new float[ beziers.Length ];
        int i;
        length = 0;
        for(i = 0; i < pts.Length; i+=4){
            beziers[k] = new LTBezier(pts[i+0],pts[i+2],pts[i+1],pts[i+3],0.05f);
            length += beziers[k].length;
            k++;
        }
        // Debug.Log("beziers.Length:"+beziers.Length + " beziers:"+beziers);
        for(i = 0; i < beziers.Length; i++){
            lengthRatio[i] = beziers[i].length / length;
        }
    }