usingUnityengine;usingSystem.Collections;usingLuainterface;//Tolua Spatial ReferencesusingDg. tweening;//dotween Spatial References Public Static classmyext{//extension methods must be in a static class Public StaticTransform Lqdomove ( ThisTransform Root,stringSTR) {//must be a static method, the first parameter is this Transform, camera, etc.Debug.Log (str); returnRoot//return transform to implement chained calls } Public StaticTransform LQ1 ( ThisTransform Root) {Debug.Log ("lq1========================"); returnRoot; } Public StaticTransform LQ2 ( ThisTransform Root) {Debug.Log ("lq2========================"); returnRoot; } Public StaticTransform LQ3 ( ThisTransform Root) {Debug.Log ("lq3========================"); returnRoot; }} Public classHellolua:monobehaviour {//Use this for initialization voidStart () {Debug.Log ("Start------------"); Luastate L=Newluastate (); stringLuapath = Application.datapath +"/lua"; L.start (); L.addsearchpath (Luapath); L.dofile ("Hellolua.lua"); L.checktop (); L.dispose (); Transform. Lqdomove ("lqdomove====================="). LQ1 (). LQ2 (). LQ3 ();//Chained callsTweener tw = transform. Domove (NewVector3 (2,2,2),1,false); tw. Setease (Ease.inoutback); tw. Setloops (4, Looptype.restart); tw. OnComplete (()={Debug.Log ("oncomplete================================"); }); } //Update is called once per frame voidUpdate () {}}
U3d extension Methods & Dotween & Tolua