Пример #1
0
        public bool Update(float elapsedSeconds, Vector2 position = default(Vector2))
        {
            _totalSeconds += elapsedSeconds;

            if (_autoTrigger)
            {
                _nextAutoTrigger -= elapsedSeconds;

                if (_nextAutoTrigger <= 0)
                {
                    Trigger(position);
                    _nextAutoTrigger = _autoTriggerFrequency;
                }
            }

            if (Buffer.Count == 0)
            {
                return(false);
            }

            ReclaimExpiredParticles();

            var iterator = Buffer.Iterator;

            while (iterator.HasNext)
            {
                var particle = iterator.Next();
                particle->Age      = (_totalSeconds - particle->Inception) / _lifeSpanSeconds;
                particle->Position = particle->Position + particle->Velocity * elapsedSeconds;
            }

            ModifierExecutionStrategy.ExecuteModifiers(Modifiers, elapsedSeconds, iterator);
            return(true);
        }
Пример #2
0
        public bool Update(float elapsedSeconds)
        {
            if (_autoTrigger)
            {
                Trigger();
                _autoTrigger = false;
            }

            _totalSeconds += elapsedSeconds;

            if (Buffer.Count == 0)
            {
                return(false);
            }

            ReclaimExpiredParticles();

            var iterator = Buffer.Iterator;

            while (iterator.HasNext)
            {
                var particle = iterator.Next();
                particle->Age      = (_totalSeconds - particle->Inception) / _term;
                particle->Position = particle->Position + particle->Velocity * elapsedSeconds;
            }

            ModifierExecutionStrategy.ExecuteModifiers(Modifiers, elapsedSeconds, iterator);
            return(true);
        }
        public void Update(float elapsedSeconds)
        {
            _totalSeconds += elapsedSeconds;

            if (Buffer.Count == 0)
            {
                return;
            }

            ReclaimExpiredParticles();

            var iterator = Buffer.Iterator;

            while (iterator.HasNext)
            {
                var particle = iterator.Next();
                particle->Age = (_totalSeconds - particle->Inception) / _term;

                particle->Position = particle->Position + particle->Velocity * elapsedSeconds;
            }

            ModifierExecutionStrategy.ExecuteModifiers(Modifiers, elapsedSeconds, iterator);
        }