public override void Perform()
    {
        CoreUpdateManager.PerformUpdateManagerRoutine();

        if (HasEntries && !isPaused)
        {
            int cnt = UpperBound;
            for (int i = LowerBound + 1; i < cnt; i++)
            {
                if (queue[i].UM_SETTINGS_GAMEPLAYUPDATE.eligibleForUpdate)
                {
#if UPDATEMANAGER_USETRYCATCH
                    try
                    {
                        queue[i].CoreGameplayUpdate();
                    }
                    catch (Exception e)
                    {
                        Debug.LogException(e);
                    }
#else
                    queue[i].CoreGameplayUpdate();
#endif
                }
            }

            CoreUpdateManager.PerformUpdateManagerRoutine();
        }
    }
Beispiel #2
0
    public override void UpdateLoop()
    {
        CoreUpdateManager.PerformManagingRoutineOnLoops();

        if (HasEntries)
        {
            int cnt = UpperBound;
            for (int i = LowerBound + 1; i < cnt; i++)
            {
                if (Queue[i].UpdateLoopSettings_CoreUpdate.EligibleForUpdate)
                {
#if UPDATEMANAGER_USETRYCATCH
                    try
                    {
                        Queue[i].CoreUpdate();
                    }
                    catch (Exception e)
                    {
                        Debug.LogException(e);
                    }
#else
                    Queue[i].CoreUpdate();
#endif
                }
            }
        }

        CoreUpdateManager.PerformManagingRoutineOnLoops();
    }
    static void Init()
    {
        if (isInited)
        {
            return;
        }

        isInited = true;

        instance = (GameplayUpdateLoop)CoreUpdateManager.RegisterBehaviourQueue <GameplayUpdateLoop>("GameplayUpdateLoop");
    }
    public static void TryInitialize()
    {
        if (isInited)
        {
            return;
        }

        isInited = true;
        Instance = new CoreUpdateManager();
        Instance.BehaviourQueues = new List <BehaviourLoopBase>(16);
    }
    protected void Awake()
    {
        _transform = (Transform)GetComponent(typeof(Transform));

#if UNITY_EDITOR
        if (Application.isPlaying)
        {
            CoreInitSetup();
            CoreUpdateManager.ScheduleBehaviourRegister(this);
        }
#else
        CoreInitSetup();
        CoreUpdateManager.ScheduleBehaviourRegister(this);
#endif

        CoreAwake();
    }
    protected void OnDestroy()
    {
#if UNITY_EDITOR
        if (Application.isPlaying)
        {
            isMarkedForDeletion = true;
            CoreOnDestroy();
            CoreUpdateManager.ScheduleBehaviourRemoval(this);
        }
        else
        {
            isMarkedForDeletion = true;
            CoreOnDestroy();
        }
#else
        isMarkedForDeletion = true;
        CoreOnDestroy();
        CoreUpdateManager.ScheduleBehaviourRemoval(this);
#endif
    }
Beispiel #7
0
    private void OnGUI()
    {
        CoreUpdateManager.TryInitialize();

        scroll = EditorGUILayout.BeginScrollView(scroll, GUIStyle.none, GUI.skin.verticalScrollbar);

        if (CoreUpdateManager.Instance != null && CoreUpdateManager.Instance.BehaviourQueues != null && CoreUpdateManager.Instance.BehaviourQueues.Count > 0)
        {
            foreach (var queue in CoreUpdateManager.Instance.BehaviourQueues)
            {
                DrawQueue(queue);
            }
        }
        else
        {
            EditorGUILayout.BeginHorizontal(EditorStyles.helpBox);
            GUILayout.Label("No loops have been initialized yet");
            EditorGUILayout.EndHorizontal();
        }

        EditorGUILayout.EndScrollView();
    }
Beispiel #8
0
 /// <summary>
 /// Register the loop instance to the CoreUpdateManager scripts. Used for debug purposes.
 /// </summary>
 protected void RegisterLoopToUpdateManager()
 {
     CoreUpdateManager.TryInitialize();
     CoreUpdateManager.Instance.BehaviourQueues.Add(this);
 }
 private void LateUpdate()
 {
     CoreUpdateManager.PerformUpdateManagerRoutine();
 }
 static void Init()
 {
     instance = (CorePoller)CoreUpdateManager.CreateComponentAsGO <CorePoller>("CorePoller");
 }