예제 #1
0
    public static int AddEffect(IntPtr l)
    {
        GameObject parent   = lua_.ToUserDataObject(1) as GameObject;
        string     path     = lua_.ToString(2);
        Vector3    position = (Vector3)lua_.ToUserDataObject(3);
        GameObject prefab   = (GameObject)ResLoader.Load(path, typeof(GameObject));
        GameObject obj      = NGUITools.AddChildWithPosition(parent, prefab, position);

        lua_.NewClassUserData(obj);
        return(1);
    }
예제 #2
0
    public static int AddEffectLocal(IntPtr l)
    {
        GameObject parent    = lua_.ToUserDataObject(1) as GameObject;
        string     path      = lua_.ToString(2);
        Vector3    uiPositon = (Vector3)lua_.ToUserDataObject(3);
        Vector3    position  = parent.transform.localToWorldMatrix.MultiplyPoint(uiPositon);
        GameObject prefab    = (GameObject)ResLoader.Load(path, typeof(GameObject));
        GameObject obj       = NGUITools.AddChildWithPosition(parent, prefab, position);

        lua_.NewClassUserData(obj);
        return(1);
    }
예제 #3
0
    public static int AddChildWithPosition(IntPtr l)
    {
        GameObject parent  = lua_.ToUserDataObject(1) as GameObject;
        string     path    = lua_.ToString(2);
        Vector3    positon = (Vector3)lua_.ToUserDataObject(3);


        GameObject   prefab = (GameObject)ResLoader.Load(path, typeof(GameObject));
        GameObject   obj    = NGUITools.AddChildWithPosition(parent, prefab, positon);
        LuaBehaviour luaB   = obj.GetComponent <LuaBehaviour>();

        if (luaB == null)
        {
            Debug.Log("There is No LuaBehaviour on new GameObj." + prefab.name);
            return(0);
        }
        lua_.RawGetI(LuaAPI.LUA_REGISTRYINDEX, luaB.Object_ref);
        return(1);
    }