예제 #1
0
        } // CreateNewEffect

        internal void RegisterEffect(UnityEngine.Component component, GenericEffect effect)
        {
            List <GenericEffect> list;

            if (!_effectsByComponent.TryGetValue(component, out list))
            {
                list.Add(effect);
                return;
            }
            list = new List <GenericEffect>();
            list.Add(effect);
            _effectsByComponent.Add(component, list);
            _currentEffects.Add(effect);
        } // RegisterEffect
예제 #2
0
        } // Update

        public void RemoveEffect(GenericEffect effectToRemove, bool finishIfActive = true)
        {
            if (finishIfActive)
            {
                effectToRemove.Finish();
            }
            if (!effectToRemove.isInfinite())
            {
                List <GenericEffect> list = _effectsByComponent[effectToRemove.GetComponent()];
                list.Remove(effectToRemove);
                if (list.Count <= 0)
                {
                    _effectsByComponent.Remove(effectToRemove.GetComponent());
                }

                _currentEffects.Remove(effectToRemove);
                _effectToDelete.Remove(effectToRemove);
            }
        } // RemoveEffect