Beispiel #1
0
 /// <summary>
 /// Updates the system once.
 /// </summary>
 /// <param name="state">The state to use.</param>
 public void Update(T state)
 {
     if (IsEnabled)
     {
         _runnable.CurrentState = state;
         Interlocked.Exchange(ref _runnable.LastIndex, -1);
         _runner.Run(_runnable);
     }
 }
        /// <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 && _component.IsNotEmpty)
            {
                PreUpdate(state);

                _runnable.ComponentsPerIndex = _component.Count / _runner.DegreeOfParallelism;
                _runnable.CurrentState       = state;
                _runner.Run(_runnable);

                PostUpdate(state);
            }
        }
Beispiel #3
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);
            }
        }