Beispiel #1
0
        public void ApplyToEmitter(EmitterSettings settings)
        {
            var modifiers = (settings.Modifiers ?? Array.Empty <IParticleModifier>()).ToList();

            // If a modifier of this type already exists, replace it with the
            // updated one without re-arranging
            var modifierReplaced = false;

            for (var x = 0; x < modifiers.Count; x++)
            {
                if (modifiers[x].GetType() == _modifier.GetType())
                {
                    modifiers[x]     = _modifier;
                    modifierReplaced = true;
                }
            }

            if (!modifierReplaced)
            {
                // This is a new modifier
                modifiers.Add(_modifier);
            }

            settings.Modifiers = modifiers;
        }
Beispiel #2
0
        private void WorkbenchOnModifierRemovalRequested(object sender, IParticleModifier e)
        {
            var command = new RemoveModifierCommand(e.GetType());

            _commandHandler.Execute(command);
        }