Пример #1
0
    private void AddItemToArray(ComponentBehaviour behaviour)
    {
        if (behaviour.GetType().GetMethod("OnUpdate").DeclaringType != typeof(ComponentBehaviour))
        {
            regularArray = ExtendAndAddItemToArray(regularArray, behaviour);
            regularUpdateArrayCount++;
        }

        if (behaviour.GetType().GetMethod("OnFixedUpdate").DeclaringType != typeof(ComponentBehaviour))
        {
            fixedArray = ExtendAndAddItemToArray(fixedArray, behaviour);
            fixedUpdateArrayCount++;
        }

        if (behaviour.GetType().GetMethod("OnLateUpdate").DeclaringType != typeof(ComponentBehaviour))
        {
            lateArray = ExtendAndAddItemToArray(lateArray, behaviour);
            lateUpdateArrayCount++;
        }

        if (behaviour.GetType().GetMethod("Tick").DeclaringType != typeof(ComponentBehaviour))
        {
            regularTickArray = ExtendAndAddItemToArray(regularTickArray, behaviour);
            regularTickArrayCount++;
        }

        if (behaviour.GetType().GetMethod("FixedTick").DeclaringType != typeof(ComponentBehaviour))
        {
            fixedTickArray = ExtendAndAddItemToArray(fixedTickArray, behaviour);
            fixedTickArrayCount++;
        }

        if (behaviour.GetType().GetMethod("LateTick").DeclaringType == typeof(ComponentBehaviour))
        {
            return;
        }

        lateTickArray = ExtendAndAddItemToArray(lateTickArray, behaviour);
        lateTickArrayCount++;
    }