示例#1
0
        private void SendCreationMessage(PoolableGameObject newObj)
        {
            newObj._createMsgSent = true;

            if (onObjectCreation != null)
            {
                onObjectCreation(newObj.gameObject);
            }

            var _poolables = newObj.GetComponentsInChildren <IGameObjectPoolable>(true);

            for (int i = 0; i < _poolables.Length; i++)
            {
                _poolables[i].OnObjectCreated();
            }
        }
示例#2
0
        private void SendCreationMessage(PoolableGameObject newObj)
        {
            newObj._createMsgSent = true;

            // The object is inactive so we have to do this manually.
            MonoBehaviour[] behaviours = newObj.GetComponentsInChildren <MonoBehaviour>(true);

            for (int i = 0; i < behaviours.Length; i++)
            {
                MethodInfo method = behaviours[i].GetType().GetMethod(
                    CREATION_FUNCTION,
                    BindingFlags.NonPublic |
                    BindingFlags.Instance |
                    BindingFlags.Public,
                    null,
                    System.Type.EmptyTypes,
                    null);

                if (method != null)
                {
                    method.Invoke(behaviours[i], null);
                }
            }
        }
示例#3
0
        private void SendCreationMessage(PoolableGameObject newObj)
        {
            // The object is inactive so we have to do this manually.
            MonoBehaviour[] behaviours = newObj.GetComponentsInChildren<MonoBehaviour>(true);

            for (int i = 0; i < behaviours.Length; i++)
            {
                MethodInfo method = behaviours[i].GetType().GetMethod(
                    CREATION_FUNCTION,
                    BindingFlags.NonPublic |
                    BindingFlags.Instance |
                    BindingFlags.Public,
                    null,
                    System.Type.EmptyTypes,
                    null);

                if (method != null)
                {
                    method.Invoke(behaviours[i], null);
                }
            }
        }