Beispiel #1
0
        /// <summary>
        /// Updates the system once.
        /// Does nothing if <see cref="IsEnabled"/> is false or if there is no component of type <typeparamref name="TComponent"/> in the <see cref="World"/>.
        /// </summary>
        /// <param name="state">The state to use.</param>
        public void Update(TState state)
        {
            if (IsEnabled && _components.IsNotEmpty)
            {
                PreUpdate(state);

                _runnable.ComponentsPerIndex = _components.Count / _runner.DegreeOfParallelism;
                _runnable.CurrentState       = state;

                if (_runnable.ComponentsPerIndex < _minComponentCountByRunnerIndex)
                {
                    Update(state, _components.AsSpan());
                }
                else
                {
                    _runner.Run(_runnable);
                }

                PostUpdate(state);
            }
        }