Esempio n. 1
0
 public void UpdatePlayer(UnityEngine.GameObject player)
 {
     if (Player != player) {
         Player = player;
         CameraHasUpdate = false;
     }
 }
 public void Update()
 {
     if (!Map.CameraHasUpdate) {
         Subject = Map.Player;
         UpdateCamera();
         Map.CameraHasUpdate = true;
     }
     UpdateCameraFieldOfView();
 }
Esempio n. 3
0
        public Shape(UnityEngine.GameObject compositeGameObject, RotationStyles rotationStyle, float initialXPos)
        {
            if (compositeGameObject == null)
                                throw new ArgumentNullException ("A shape MUST contain a game object!");

                        Name = compositeGameObject.name;
                        mCompositeGameObject = compositeGameObject;
                        mInitialXPos = initialXPos;
                        mRotationStyle = rotationStyle;
        }
        public UnityEnginePrefabAdapter(UnityEngine.GameObject gameObjectPrefab)
        {
            if (gameObjectPrefab == null)
                throw new ArgumentNullException(nameof(gameObjectPrefab), nameof(UnityEngine.GameObject) + " must not be null.");

            //Could change so we should grab it now
            PrefabName = prefabbedGameObjectInstance.name;

            prefabbedGameObjectInstance = gameObjectPrefab;
        }
        private static SPThreadPool CreateInstance()
        {
            if (object.ReferenceEquals(_instance, null))
            {
                var go = new UnityEngine.GameObject("Spacepuppy.SPThreadPool");
                _instance = go.AddComponent<SPThreadPool>();
                UnityEngine.Object.DontDestroyOnLoad(go);
            }

            return _instance;
        }
Esempio n. 6
0
        public void SubscribeOnce()
        {
            var go = new UnityEngine.GameObject();
            var mb = go.AddComponent<UnityEngine.MonoBehaviour>();

            int callNum1 = 0;
            mb.Subscribe("topic1", () => { callNum1++; }).Once();
            Publisher.Publish("topic1");
            Publisher.Publish("topic1");
            Publisher.Publish("topic1");
            Assert.AreEqual(callNum1, 1);
        }
Esempio n. 7
0
 public void attach2Parent()
 {
     if (m_pntGo != null)
     {
         if (m_bNeedPlaceHolderGo)
         {
             if (m_placeHolderGo == null)
             {
                 m_placeHolderGo = new UnityEngine.GameObject();
                 UtilApi.SetParent(m_placeHolderGo, m_pntGo, false);
             }
             UtilApi.SetParent(m_selfGo, m_placeHolderGo, false);
         }
         else
         {
             UtilApi.SetParent(m_selfGo, m_pntGo, false);
         }
     }
 }
        static int _m_ResetSize(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


            xc.RedPointDataMgr __cl_gen_to_be_invoked = (xc.RedPointDataMgr)translator.FastGetCSObj(L, 1);


            try {
                {
                    UnityEngine.GameObject go = (UnityEngine.GameObject)translator.GetObject(L, 2, typeof(UnityEngine.GameObject));

                    __cl_gen_to_be_invoked.ResetSize(go);



                    return(0);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
        }
Esempio n. 9
0
        static StackObject *set_Item_1(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 3);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            ILRuntime.Runtime.Intepreter.ILTypeInstance @value = (ILRuntime.Runtime.Intepreter.ILTypeInstance) typeof(ILRuntime.Runtime.Intepreter.ILTypeInstance).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            UnityEngine.GameObject @key = (UnityEngine.GameObject) typeof(UnityEngine.GameObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
            System.Collections.Generic.Dictionary <UnityEngine.GameObject, ILRuntime.Runtime.Intepreter.ILTypeInstance> instance_of_this_method = (System.Collections.Generic.Dictionary <UnityEngine.GameObject, ILRuntime.Runtime.Intepreter.ILTypeInstance>) typeof(System.Collections.Generic.Dictionary <UnityEngine.GameObject, ILRuntime.Runtime.Intepreter.ILTypeInstance>).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            instance_of_this_method[key] = value;

            return(__ret);
        }
        static StackObject *SetLayer_16(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 3);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.String @layerName = (System.String) typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            System.Boolean @withChildren = ptr_of_this_method->Value == 1;

            ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
            UnityEngine.GameObject @gameObjectRoot = (UnityEngine.GameObject) typeof(UnityEngine.GameObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);


            LCL.MonoTool.SetLayer(@gameObjectRoot, @withChildren, @layerName);

            return(__ret);
        }
        static int _m_AddToEntity_xlua_st_(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);



                {
                    Unity.Entities.EntityManager _entityManager = (Unity.Entities.EntityManager)translator.GetObject(L, 1, typeof(Unity.Entities.EntityManager));
                    UnityEngine.GameObject       _gameObject    = (UnityEngine.GameObject)translator.GetObject(L, 2, typeof(UnityEngine.GameObject));
                    Unity.Entities.Entity        _entity; translator.Get(L, 3, out _entity);

                    Unity.Entities.GameObjectEntity.AddToEntity(_entityManager, _gameObject, _entity);



                    return(0);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
Esempio n. 12
0
        static StackObject *IsFilteringDepth_10(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 2);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            UnityEngine.GameObject obj = (UnityEngine.GameObject) typeof(UnityEngine.GameObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);
            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method);
            UnityEngine.ContactFilter2D instance_of_this_method;
            instance_of_this_method = (UnityEngine.ContactFilter2D) typeof(UnityEngine.ContactFilter2D).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));

            var result_of_this_method = instance_of_this_method.IsFilteringDepth(obj);

            WriteBackInstance(__domain, ptr_of_this_method, __mStack, ref instance_of_this_method);

            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value      = result_of_this_method ? 1 : 0;
            return(__ret + 1);
        }
Esempio n. 13
0
        /// <summary>
        /// Spawn 对象
        /// </summary>
        /// <param name="objAssetName">资源名称 带路径名 </param>
        /// <returns></returns>
        public async Task <UnityEngine.GameObject> Spawn(string objAssetName)
        {
            UnityEngine.GameObject target       = null;
            NormalObject           normalObject = m_InstancePool.Spawn(objAssetName);

            if (normalObject == null)
            {
                //UnityEngine.GameObject objAsset = ResourceManager.Instance.LoadAssetDataPath<UnityEngine.GameObject>(objAssetName);
                UnityEngine.GameObject objAsset = await GameFrameEntry.GetModule <AssetbundleModule>().LoadPrefab(objAssetName);

                if (objAsset != null)
                {
                    normalObject = new NormalObject(objAssetName, null, objAsset, m_UnspawnParent);
                    m_InstancePool.Register(normalObject, true);
                }
            }
            if (normalObject != null)
            {
                target = normalObject.Target as UnityEngine.GameObject;
            }
            return(target);
        }
Esempio n. 14
0
        static StackObject *Instantiate_16(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 3);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            UnityEngine.Quaternion @rotation = new UnityEngine.Quaternion();
            if (ILRuntime.Runtime.Generated.CLRBindings.s_UnityEngine_Quaternion_Binding_Binder != null)
            {
                ILRuntime.Runtime.Generated.CLRBindings.s_UnityEngine_Quaternion_Binding_Binder.ParseValue(ref @rotation, __intp, ptr_of_this_method, __mStack, true);
            }
            else
            {
                @rotation = (UnityEngine.Quaternion) typeof(UnityEngine.Quaternion).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
                __intp.Free(ptr_of_this_method);
            }

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            UnityEngine.Vector3 @position = new UnityEngine.Vector3();
            if (ILRuntime.Runtime.Generated.CLRBindings.s_UnityEngine_Vector3_Binding_Binder != null)
            {
                ILRuntime.Runtime.Generated.CLRBindings.s_UnityEngine_Vector3_Binding_Binder.ParseValue(ref @position, __intp, ptr_of_this_method, __mStack, true);
            }
            else
            {
                @position = (UnityEngine.Vector3) typeof(UnityEngine.Vector3).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
                __intp.Free(ptr_of_this_method);
            }

            ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
            UnityEngine.GameObject @original = (UnityEngine.GameObject) typeof(UnityEngine.GameObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);


            var result_of_this_method = UnityEngine.Object.Instantiate <UnityEngine.GameObject>(@original, @position, @rotation);

            return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method));
        }
Esempio n. 15
0
        public void DebugDrawDiffraction(UnityEngine.GameObject gameObject)
        {
            var  listenerPosition = UnityEngine.Vector3.zero;
            var  emitterPosition  = UnityEngine.Vector3.zero;
            uint numValidPaths    = (uint)diffractionPathInfoArray.Count();

            if (AkSoundEngine.QueryDiffractionPaths(gameObject, 0, ref listenerPosition, ref emitterPosition, diffractionPathInfoArray, out numValidPaths) != AKRESULT.AK_Success)
            {
                return;
            }

            for (var idxPath = (int)numValidPaths - 1; idxPath >= 0; --idxPath)
            {
                var path = diffractionPathInfoArray[idxPath];
                if (path.nodeCount <= 0)
                {
                    continue;
                }

                var prevPt = listenerPosition;

                for (var idxSeg = 0; idxSeg < (int)path.nodeCount; ++idxSeg)
                {
                    var pt = path.GetNodes((uint)idxSeg);
                    UnityEngine.Debug.DrawLine(prevPt, pt, colorGreen);

                    float angle = path.GetAngles((uint)idxSeg) / UnityEngine.Mathf.PI;
                    if (angle > 0)
                    {
                        string angleStr = angle.ToString("0.#%");
                        DrawLabelInFrontOfCam(pt, angleStr, 100000, colorGreen);
                    }

                    prevPt = pt;
                }

                UnityEngine.Debug.DrawLine(prevPt, emitterPosition, colorGreen);
            }
        }
        static StackObject *SetResult_4(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 2);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            UnityEngine.GameObject @result = (UnityEngine.GameObject) typeof(UnityEngine.GameObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method);
            System.Runtime.CompilerServices.AsyncTaskMethodBuilder <UnityEngine.GameObject> instance_of_this_method = (System.Runtime.CompilerServices.AsyncTaskMethodBuilder <UnityEngine.GameObject>) typeof(System.Runtime.CompilerServices.AsyncTaskMethodBuilder <UnityEngine.GameObject>).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));

            instance_of_this_method.SetResult(@result);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            WriteBackInstance(__domain, ptr_of_this_method, __mStack, ref instance_of_this_method);

            __intp.Free(ptr_of_this_method);
            return(__ret);
        }
Esempio n. 17
0
    // Create a Wwise Global object containing the initializer and terminator scripts. Set the soundbank path of the initializer script.
    // This game object will live for the whole project; there is no need to instanciate one per scene.
    private static void CreateWwiseGlobalObject()
    {
        // Look for a game object which has the initializer component
        var AkInitializers = UnityEngine.Object.FindObjectsOfType <AkInitializer>();

        UnityEngine.GameObject WwiseGlobalGameObject = null;
        if (AkInitializers.Length > 0)
        {
            UnityEditor.Undo.DestroyObjectImmediate(AkInitializers[0].gameObject);
        }

        WwiseGlobalGameObject = new UnityEngine.GameObject("WwiseGlobal");

        // attach initializer component
        var AkInit = UnityEditor.Undo.AddComponent <AkInitializer>(WwiseGlobalGameObject);

        // Set the soundbank path property on the initializer
        //AkInit.basePath = Settings.SoundbankPath;

        // Set focus on WwiseGlobal
        UnityEditor.Selection.activeGameObject = WwiseGlobalGameObject;
    }
Esempio n. 18
0
        public void the_first_point_should_containt_the_spawn()
        {
            var s = new UnityEngine.GameObject();

            s.AddComponent <Route_with_spawn>();
            Route_with_spawn route = s.GetComponent <Route_with_spawn>();

            route.points = new System.Collections.Generic.List <UnityEngine.Transform>();
            route.clean_points();
            route.proto_point = new UnityEngine.GameObject();
            var p = new UnityEngine.GameObject();

            p.AddComponent <spawner.Spawn_point>();
            route.proto_spawn_point = p.GetComponent <spawner.Spawn_point>();

            var generator = route.get_points().GetEnumerator();

            generator.MoveNext();
            var spawn = generator.Current.GetComponent <spawner.Spawn_point>();

            Assert.IsNotNull(spawn);
        }
Esempio n. 19
0
        public void __Gen_Delegate_Imp11(bool p0, UnityEngine.GameObject p1)
        {
#if THREAD_SAFE || HOTFIX_ENABLE
            lock (luaEnv.luaEnvLock)
            {
#endif
            RealStatePtr L = luaEnv.rawL;
            int errFunc    = LuaAPI.pcall_prepare(L, errorFuncRef, luaReference);
            ObjectTranslator translator = luaEnv.translator;
            LuaAPI.lua_pushboolean(L, p0);
            translator.Push(L, p1);

            PCall(L, 2, 0, errFunc);



            LuaAPI.lua_settop(L, errFunc - 1);

#if THREAD_SAFE || HOTFIX_ENABLE
        }
#endif
        }
Esempio n. 20
0
        static StackObject* Invoke_0(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* ptr_of_this_method;
            StackObject* __ret = ILIntepreter.Minus(__esp, 3);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            UnityEngine.GameObject @obj = (UnityEngine.GameObject)typeof(UnityEngine.GameObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            UnityEngine.GameObject @go = (UnityEngine.GameObject)typeof(UnityEngine.GameObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
            global::UIEventListener.ObjectDelegate instance_of_this_method = (global::UIEventListener.ObjectDelegate)typeof(global::UIEventListener.ObjectDelegate).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            instance_of_this_method.Invoke(@go, @obj);

            return __ret;
        }
Esempio n. 21
0
        static int _m_SetGameObject(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


            UIPreviewModel __cl_gen_to_be_invoked = (UIPreviewModel)translator.FastGetCSObj(L, 1);


            try {
                {
                    UnityEngine.GameObject go = (UnityEngine.GameObject)translator.GetObject(L, 2, typeof(UnityEngine.GameObject));

                    __cl_gen_to_be_invoked.SetGameObject(go);



                    return(0);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
        }
        static int _m_GetComponent(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


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


                int gen_param_count = LuaAPI.lua_gettop(L);

                if (gen_param_count == 2 && translator.Assignable <System.Type>(L, 2))
                {
                    System.Type _type = (System.Type)translator.GetObject(L, 2, typeof(System.Type));

                    UnityEngine.Component gen_ret = gen_to_be_invoked.GetComponent(_type);
                    translator.Push(L, gen_ret);



                    return(1);
                }
                if (gen_param_count == 2 && (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING))
                {
                    string _type = LuaAPI.lua_tostring(L, 2);

                    UnityEngine.Component gen_ret = gen_to_be_invoked.GetComponent(_type);
                    translator.Push(L, gen_ret);



                    return(1);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }

            return(LuaAPI.luaL_error(L, "invalid arguments to UnityEngine.GameObject.GetComponent!"));
        }
        static StackObject *Add_0(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 3);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            UnityEngine.GameObject @value = (UnityEngine.GameObject) typeof(UnityEngine.GameObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            System.String @key = (System.String) typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
            System.Collections.Generic.Dictionary <System.String, UnityEngine.GameObject> instance_of_this_method = (System.Collections.Generic.Dictionary <System.String, UnityEngine.GameObject>) typeof(System.Collections.Generic.Dictionary <System.String, UnityEngine.GameObject>).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            instance_of_this_method.Add(@key, @value);

            return(__ret);
        }
        static int _m_GetComponents(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


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


                int gen_param_count = LuaAPI.lua_gettop(L);

                if (gen_param_count == 2 && translator.Assignable <System.Type>(L, 2))
                {
                    System.Type _type = (System.Type)translator.GetObject(L, 2, typeof(System.Type));

                    UnityEngine.Component[] gen_ret = gen_to_be_invoked.GetComponents(_type);
                    translator.Push(L, gen_ret);



                    return(1);
                }
                if (gen_param_count == 3 && translator.Assignable <System.Type>(L, 2) && translator.Assignable <System.Collections.Generic.List <UnityEngine.Component> >(L, 3))
                {
                    System.Type _type = (System.Type)translator.GetObject(L, 2, typeof(System.Type));
                    System.Collections.Generic.List <UnityEngine.Component> _results = (System.Collections.Generic.List <UnityEngine.Component>)translator.GetObject(L, 3, typeof(System.Collections.Generic.List <UnityEngine.Component>));

                    gen_to_be_invoked.GetComponents(_type, _results);



                    return(0);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }

            return(LuaAPI.luaL_error(L, "invalid arguments to UnityEngine.GameObject.GetComponents!"));
        }
Esempio n. 25
0
        /// <summary>
        /// Registers a tool with the game. It still must be added to a tool collection to be
        /// visible.
        /// </summary>
        /// <typeparam name="T">The tool type to register.</typeparam>
        /// <param name="controller">The player controller which will be its parent; consider
        /// using in a postfix on PlayerController.OnPrefabInit.</param>
        public static void RegisterTool <T>(PlayerController controller) where T : InterfaceTool
        {
            if (controller == null)
            {
                throw new ArgumentNullException("controller");
            }
            // Create list so that new tool can be appended at the end
            var interfaceTools = ListPool <InterfaceTool, PlayerController> .Allocate();

            interfaceTools.AddRange(controller.tools);
            var newTool = new UnityEngine.GameObject(typeof(T).Name);

            newTool.AddComponent <T>();
            // Reparent tool to the player controller, then enable/disable to load it
            newTool.transform.SetParent(controller.gameObject.transform);
            newTool.gameObject.SetActive(true);
            newTool.gameObject.SetActive(false);
            // Add tool to tool list
            interfaceTools.Add(newTool.GetComponent <InterfaceTool>());
            controller.tools = interfaceTools.ToArray();
            interfaceTools.Recycle();
        }
Esempio n. 26
0
        static int _m_CreatePrimitive_xlua_st_(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);



                {
                    UnityEngine.PrimitiveType _type; translator.Get(L, 1, out _type);

                    UnityEngine.GameObject gen_ret = UnityEngine.GameObject.CreatePrimitive(
                        _type);
                    translator.Push(L, gen_ret);



                    return(1);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
Esempio n. 27
0
        static int _m_Find_xlua_st_(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);



                {
                    string _name = LuaAPI.lua_tostring(L, 1);

                    UnityEngine.GameObject gen_ret = UnityEngine.GameObject.Find(
                        _name);
                    translator.Push(L, gen_ret);



                    return(1);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
Esempio n. 28
0
        static StackObject *Instantiate_4(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 3);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.Boolean @worldPositionStays = ptr_of_this_method->Value == 1;

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            UnityEngine.Transform @parent = (UnityEngine.Transform) typeof(UnityEngine.Transform).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
            UnityEngine.GameObject @original = (UnityEngine.GameObject) typeof(UnityEngine.GameObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);


            var result_of_this_method = UnityEngine.Object.Instantiate <UnityEngine.GameObject>(@original, @parent, @worldPositionStays);

            return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method));
        }
Esempio n. 29
0
        static int _m_CreateChildGameObject_xlua_st_(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);



            try {
                {
                    UnityEngine.GameObject _parent = (UnityEngine.GameObject)translator.GetObject(L, 1, typeof(UnityEngine.GameObject));
                    string _name = LuaAPI.lua_tostring(L, 2);

                    UnityEngine.GameObject __cl_gen_ret = xc.CommonTool.CreateChildGameObject(_parent, _name);
                    translator.Push(L, __cl_gen_ret);



                    return(1);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
        }
Esempio n. 30
0
        static StackObject *GetCollisionEvents_1(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 3);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.Collections.Generic.List <UnityEngine.ParticleCollisionEvent> collisionEvents = (System.Collections.Generic.List <UnityEngine.ParticleCollisionEvent>) typeof(System.Collections.Generic.List <UnityEngine.ParticleCollisionEvent>).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);
            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            UnityEngine.GameObject go = (UnityEngine.GameObject) typeof(UnityEngine.GameObject).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);
            ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
            UnityEngine.ParticleSystem ps = (UnityEngine.ParticleSystem) typeof(UnityEngine.ParticleSystem).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            var result_of_this_method = UnityEngine.ParticlePhysicsExtensions.GetCollisionEvents(ps, go, collisionEvents);

            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value      = result_of_this_method;
            return(__ret + 1);
        }
Esempio n. 31
0
            private static void ShowHierarchy(UnityEngine.GameObject gameObject, string indent)
            {
                if (allChildrenLogged.Contains(gameObject))
                {
                    return;
                }

                allChildrenLogged.Add(gameObject);

                Warning(indent + gameObject);
                indent += "  ";
                int childCount = gameObject.transform.childCount;

                for (int i = 0; i < childCount; i++)
                {
                    UnityEngine.Transform child = gameObject.transform.GetChild(i);
                    if (child.gameObject != null)
                    {
                        ShowHierarchy(child.gameObject, indent);
                    }
                }
            }
Esempio n. 32
0
        static int _m_GetRootGameObj(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                Game.ObjBase __cl_gen_to_be_invoked = (Game.ObjBase)translator.FastGetCSObj(L, 1);



                {
                    UnityEngine.GameObject __cl_gen_ret = __cl_gen_to_be_invoked.GetRootGameObj(  );
                    translator.Push(L, __cl_gen_ret);



                    return(1);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
        }
Esempio n. 33
0
        public static bool PostNotification <T>(UnityEngine.GameObject sender, T notification, bool bNotifyEntity = false) where T : Notification
        {
            if (sender == null)
            {
                throw new ArgumentNullException("sender");
            }
            if (notification == null)
            {
                throw new ArgumentNullException("notification");
            }

            if (bNotifyEntity)
            {
                var dispatcher = sender.AddOrGetComponent <GameObjectNotificationDispatcher>();
                return(dispatcher.Observers.PostNotification <T>(notification, bNotifyEntity));
            }
            else
            {
                var dispatcher = sender.GetComponent <GameObjectNotificationDispatcher>();
                return(dispatcher != null && dispatcher.Observers.PostNotification <T>(notification, bNotifyEntity));
            }
        }
Esempio n. 34
0
        static int _m_BuildHumanAvatar_xlua_st_(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);



                {
                    UnityEngine.GameObject       _go = (UnityEngine.GameObject)translator.GetObject(L, 1, typeof(UnityEngine.GameObject));
                    UnityEngine.HumanDescription _humanDescription; translator.Get(L, 2, out _humanDescription);

                    UnityEngine.Avatar gen_ret = UnityEngine.AvatarBuilder.BuildHumanAvatar(_go, _humanDescription);
                    translator.Push(L, gen_ret);



                    return(1);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
Esempio n. 35
0
    // 胜利界面item
    void VictorPanel(UnityEngine.GameObject item, out UITexture icon, out UISprite frame, out UILabel lName, out UILabel num)
    {
        NGUITools.SetActive(item, true);
        UITexture ut = item.gameObject.GetComponent <UITexture>();

        icon = ut;

        UnityEngine.Transform tf = item.transform.Find("kuang");
        UISprite us = tf.gameObject.GetComponent <UISprite>();

        frame = us;

        tf = item.transform.Find("name");
        UILabel ul = tf.gameObject.GetComponent <UILabel>();

        lName = ul;

        tf = item.transform.Find("lblnum");
        UILabel ulnum = tf.gameObject.GetComponent <UILabel>();

        num = ulnum;
    }
Esempio n. 36
0
        static int _m_BuildGenericAvatar_xlua_st_(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);



                {
                    UnityEngine.GameObject _go      = (UnityEngine.GameObject)translator.GetObject(L, 1, typeof(UnityEngine.GameObject));
                    string _rootMotionTransformName = LuaAPI.lua_tostring(L, 2);

                    UnityEngine.Avatar gen_ret = UnityEngine.AvatarBuilder.BuildGenericAvatar(_go, _rootMotionTransformName);
                    translator.Push(L, gen_ret);



                    return(1);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
Esempio n. 37
0
    public override void HandleEvent(UnityEngine.GameObject in_gameObject)
    {
        var gameObj = useOtherObject && in_gameObject != null ? in_gameObject : gameObject;

        soundEmitterObject = gameObj;

        if (enableActionOnEvent)
        {
            data.ExecuteAction(gameObj, actionOnEventType, (int)transitionDuration * 1000,
                               curveInterpolation);
            return;
        }

        if (m_callbackData != null)
        {
            playingId = data.Post(gameObj, (uint)m_callbackData.uFlags, Callback);
        }
        else
        {
            playingId = data.Post(gameObj);
        }
    }
Esempio n. 38
0
 public static void EnsureInitialized()
 {
     try
     {
         if (EventPump.Instance == null)
         {
             lock (s_Lock)
             {
                 if (EventPump.Instance == null)
                 {
                     UnityEngine.GameObject parent = new UnityEngine.GameObject("Kinect Desktop Event Pump");
                     EventPump.Instance = parent.AddComponent<Helper.EventPump>();
                     DontDestroyOnLoad(parent);
                 }
             }
         }
     }
     catch
     {
         UnityEngine.Debug.LogError("Events must be registered on the main thread.");
         return;
     }
 }
Esempio n. 39
0
	public static OCChunkRenderer CreateChunkRenderer(Vector3i pos, OpenCog.Map.OCMap map, OCChunk chunk) {
		UnityEngine.GameObject go = new UnityEngine.GameObject("("+pos.x+" "+pos.y+" "+pos.z+")", typeof(UnityEngine.MeshFilter), typeof(UnityEngine.MeshRenderer), typeof(OpenCog.Map.OCChunkRenderer));
		go.transform.parent = map.transform;
		go.transform.localPosition = new UnityEngine.Vector3(pos.x*OpenCog.Map.OCChunk.SIZE_X, pos.y*OpenCog.Map.OCChunk.SIZE_Y, pos.z*OpenCog.Map.OCChunk.SIZE_Z);
		go.transform.localRotation = UnityEngine.Quaternion.identity;
		go.transform.localScale = UnityEngine.Vector3.one;
		
		OCChunkRenderer chunkRenderer = go.GetComponent<OCChunkRenderer>();
		chunkRenderer.BlockSet = map.GetBlockSet();
		chunkRenderer.Chunk = chunk;

		go.GetComponent<UnityEngine.Renderer>().castShadows = false;
		go.GetComponent<UnityEngine.Renderer>().receiveShadows = false;
		
		return chunkRenderer;
	}
Esempio n. 40
0
		//---------------------------------------------------------------------------

	#endregion

		//---------------------------------------------------------------------------

	#region Private Member Functions

		//---------------------------------------------------------------------------
	
		/// <summary>
		/// Initializes this instance.  Set default values here.
		/// </summary>
		private void Initialize ()
		{
			// TODO: Remove stuff below once (real) property exposition components are working.
			if (_NPCAgent == null)
			{
				_NPCAgent = NPCAvatarMember;
			}
		}
Esempio n. 41
0
 public Action_bt_node_test_action_ut_0_node7()
 {
     this.m_resultOption = EBTStatus.BT_SUCCESS;
     method_p0 = null;
 }
 public EntityMissingReferenceException(UnityEngine.GameObject root)
     : base("GameObject entity '" + root.name + "' is missing a reference to an object pertinenant to operation.", null)
 {
     _root = root;
 }
 public EntityMissingReferenceException(UnityEngine.GameObject root, Type tp)
     : base("GameObject entity '" + root.name + "' is missing a reference to an object of type '" + tp.Name + "' which is pertinenant to operation.", tp)
 {
     _root = root;
 }
 public EntityMissingReferenceException(UnityEngine.GameObject root, string msg, Type tp)
     : base(msg, tp)
 {
     _root = root;
 }
	//---------------------------------------------------------------------------

	#endregion

	//---------------------------------------------------------------------------

	#region Private Member Functions

	//---------------------------------------------------------------------------
	
	private void CullUselessChildren(GameObject parent)
	{
		foreach(Transform child in parent.transform)
		{
			List<OCAction> actions = 
				child.gameObject.GetComponentsInChildren<OCAction>(true).ToList();
				
			//actions.AddRange(child.gameObject.GetComponents<OCAction>().ToList());
				
			if(actions == null || actions.Count == 0)
			{
				GameObject.Destroy(child.gameObject);
			}
			else
			{
				if(child.gameObject.GetComponent<OCAction>() == null)
					CullUselessChildren(child.gameObject);
			}
		}
	}
Esempio n. 46
0
        /// <summary>
        /// This does the reusable parts of the overloaded Spawn() method.
        /// </summary>
        /// <returns>The spawned game object for Hikari.</returns>
        private static UnityEngine.GameObject StartSpawn ( )
        {
            // Error if hikari exists
            if ( hikari != null )
                throw new Exception("Cannot spawn a second Hikari instance.");

            // Generate new Hikari and game object.
            UnityEngine.GameObject obj = new UnityEngine.GameObject("Autogenerated_HikariObject");
            DontDestroyOnLoad(obj);
            hikari = obj.AddComponent<Hikari>();

            return obj;
        }
	public void SetInterior (UnityEngine.GameObject interior)
	{
		_interior = interior;
	}