Esempio n. 1
0
        /// <summary>
        /// Cleans the action list when an associated component is destroyed
        /// </summary>
        internal void OnComponentDisposed(Object sender, EventArgs e)
        {
            Component comp = (Component)sender;

            Debug.Assert(comp != null);
            TAction a = (TAction)_components[comp];

            if (a != null)
            {
                a.SetComponent(comp, false);
                _components.Remove(comp);
            }
        }
Esempio n. 2
0
        public void SetAction(Component comp, TAction value)
        {
            Debug.Assert(comp != null && value != null);
            TAction res = (TAction)_components[comp];

            if (res != null)
            {
                if (value == res)
                {
                    return;
                }
                res.SetComponent(comp, false);
                _components.Remove(comp);
            }

            if (value != Actions.Null)
            {
                value._owner = this;
                value.SetComponent(comp, true);
                _components.Add(comp, value);
            }
        }