static int Play(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 1 && TypeChecker.CheckTypes(L, 1, typeof(Shake))) { Shake obj = (Shake)ToLua.ToObject(L, 1); obj.Play(); return(0); } else if (count == 4 && TypeChecker.CheckTypes(L, 1, typeof(Shake), typeof(float), typeof(float), typeof(float))) { Shake obj = (Shake)ToLua.ToObject(L, 1); float arg0 = (float)LuaDLL.lua_tonumber(L, 2); float arg1 = (float)LuaDLL.lua_tonumber(L, 3); float arg2 = (float)LuaDLL.lua_tonumber(L, 4); obj.Play(arg0, arg1, arg2); return(0); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to method: Shake.Play")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
public void Shake(float strength, float rate, float time) { Shake shake = GetComponent <Shake>(); if (shake == null) { shake = gameObject.AddComponent <Shake>(); } shake.shakeStrength = strength; shake.shakeRate = rate; shake.shakeTime = time; shake.Play(); }