static int _m_CompareTag(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                UnityEngine.GameObject gen_to_be_invoked = (UnityEngine.GameObject)translator.FastGetCSObj(L, 1);



                {
                    string _tag = LuaAPI.lua_tostring(L, 2);

                    bool gen_ret = gen_to_be_invoked.CompareTag(
                        _tag);
                    LuaAPI.lua_pushboolean(L, gen_ret);



                    return(1);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
Esempio n. 2
0
        public static int CompareTag(IntPtr L)
        {
            int result = 1;
            int count  = LuaDLL.lua_gettop(L);

            if (count != 2)
            {
                LuaStatic.traceback(L, "count not enough");
                LuaDLL.lua_error(L);
                return(result);
            }
            UnityEngine.GameObject obj = LuaStatic.GetObj(L, 1) as UnityEngine.GameObject;
            String arg1 = (String)LuaStatic.GetObj(L, 2);

            LuaDLL.lua_pushboolean(L, obj.CompareTag(arg1));
            return(result);
        }
Esempio n. 3
0
        int UnityEngineGameObject_m_CompareTag(RealStatePtr L, int gen_param_count)
        {
            ObjectTranslator translator = this;


            UnityEngine.GameObject gen_to_be_invoked = (UnityEngine.GameObject)translator.FastGetCSObj(L, 1);


            {
                string _tag = LuaAPI.lua_tostring(L, 2);

                bool gen_ret = gen_to_be_invoked.CompareTag(_tag);
                LuaAPI.lua_pushboolean(L, gen_ret);



                return(1);
            }
        }
Esempio n. 4
0
        private bool CheckCondition(UnityEngine.GameObject objectToCheck, System.Collections.Generic.List <string> listOfConditions)
        {
            bool valid = true;

            foreach (var condition in listOfConditions)
            {
                var option = CheckOption(condition);
                switch (option)
                {
                case 1:    //name
                    var name = condition;
                    valid = objectToCheck.name.Equals(name);
                    break;

                case 2:    //tag
                    var tagName = condition.Substring(5, condition.Length - 5);
                    valid = objectToCheck.CompareTag(tagName);
                    break;

                case 3:    //layer
                    var layerName = condition.Substring(7, condition.Length - 7);
                    int layerId   = UnityEngine.LayerMask.NameToLayer(layerName);
                    valid = objectToCheck.layer.Equals(layerId);
                    break;

                case 4:    //component
                    var componentName = condition.Substring(11, condition.Length - 11);
                    var list          = objectToCheck.GetComponents(typeof(UnityEngine.Component));
                    valid = false;

                    for (int i = 0; i < list.Length; i++)
                    {
                        if (componentName.Equals(list[i].GetType().Name))
                        {
                            valid = true;
                            break;
                        }
                    }
                    break;

                case 5:    //id
                    var id = System.Convert.ToInt32(condition.Substring(4, condition.Length - 4));
                    valid = (objectToCheck.GetInstanceID() == id);
                    break;

                case 6:    //contains
                    var substring      = condition.Substring(9, condition.Length - 10);
                    var splitedValue   = substring.Split(',');
                    var selector       = splitedValue[0];
                    var value          = splitedValue[1];
                    var optionContains = CheckOption(selector);
                    switch (optionContains)
                    {
                    case 2:
                        valid = objectToCheck.tag.Contains(value);
                        break;

                    case 3:
                        var layerNm = UnityEngine.LayerMask.LayerToName(objectToCheck.layer);
                        valid = layerNm.Contains(value);
                        break;

                    case 4:
                        componentName = value;
                        list          = objectToCheck.GetComponents(typeof(UnityEngine.Component));
                        valid         = false;

                        for (int i = 0; i < list.Length; i++)
                        {
                            if (componentName.Contains(list[i].GetType().Name))
                            {
                                valid = true;
                                break;
                            }
                        }
                        break;

                    case 5:
                        var stringId = objectToCheck.GetInstanceID().ToString();
                        valid = stringId.Contains(value);
                        break;

                    case 8:
                        valid = objectToCheck.name.Contains(value);
                        break;

                    default:
                        throw new System.Exception("No such selector is implemented");
                    }
                    break;
                }
                if (!valid)
                {
                    break;
                }
            }
            return(valid);
        }