コード例 #1
0
        void LuaNPCScript(GameObject obj)
        {
            if (Time.time - time > interDeltime)
            {
                time = Time.time;
                MapPlayer  mapPlayer  = GetComponent <MapPlayer>();
                MapMonster mapMonster = GetComponent <MapMonster>();
                if (mapPlayer != null && mapPlayer.enabled)
                {
                    mapPlayer.UpdateDirection((obj.transform.position - transform.position).normalized, true);
                }
                else if (mapMonster != null && mapMonster.enabled)
                {
                    mapMonster.UpdateDirection((obj.transform.position - transform.position).normalized);
                }

                string fileName = (script == null) ? "guide/" + LuaTextName + ".lua" : script.name;
                if (luaThreadEval == null)
                {
                    luaThreadEval = LuaController.GetLuaValue <LuaThreadEval>("ThreadEvalWithGameObject");
                }
                if (luaThreadEval != null)
                {
                    luaThreadEval(fileName, fileName, this, values);
                }
                else
                {
                    LuaController.DoFile(fileName, values);
                }
            }
        }
コード例 #2
0
        public virtual void Interact(GameObject obj)
        {
            if (Time.realtimeSinceStartup - last_interact_time < interact_protect_time)
            {
                return;
            }

            last_interact_time = Time.realtimeSinceStartup;
            MapPlayer  mapPlayer  = GetComponent <MapPlayer>();
            MapMonster mapMonster = GetComponent <MapMonster>();

            if (mapPlayer != null && mapPlayer.enabled)
            {
                mapPlayer.UpdateDirection((obj.transform.position - transform.position).normalized, true);
            }
            else if (mapMonster != null && mapMonster.enabled)
            {
                mapMonster.UpdateDirection((obj.transform.position - transform.position).normalized);
            }
            else
            {
            }

            string fileName = (script == null) ? "guide/" + LuaTextName + ".lua" : script.name;

            if (luaThreadEval == null)
            {
                luaThreadEval = LuaController.GetLuaValue <LuaThreadEval>("ThreadEvalWithGameObject");
            }
            if (luaThreadEval != null)
            {
                luaThreadEval(fileName, fileName, this, values);
            }
            else
            {
                LuaController.DoFile(fileName, values);
            }
        }