Ejemplo n.º 1
0
        /// <summary>
        /// Add a delegate reference to this list of action callbacks.
        /// </summary>
        /// <param name="compAct">the composite action to store the reference</param>
        /// <param name="action">the delegate to add</param>
        /// <returns>a new kappa action with a combined list</returns>
        public static CompositeAction operator +(CompositeAction compAct, Action action)
        {
            CompositeAction toRet = new CompositeAction();

            toRet.actions.Add(action);
            if (compAct != null)
            {
                toRet.actions.UnionWith(compAct.actions);
            }
            return(toRet);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Remove a delegate reference from the list of action callbacks
        /// </summary>
        /// <param name="compAct">the composite action which has the reference</param>
        /// <param name="action">the delegate to remove</param>
        /// <returns>a new kappa action with a combined list</returns>
        public static CompositeAction operator -(CompositeAction compAct, Action action)
        {
            if (compAct == null)
            {
                return(null);
            }
            CompositeAction toRet = new CompositeAction();

            toRet.actions.UnionWith(compAct.actions);
            toRet.actions.Remove(action);
            return(toRet);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Add two KappaActions together
        /// </summary>
        /// <param name="a">the first KappaAction</param>
        /// <param name="b">the second KappaAction</param>
        /// <returns>a new KappaAction with their lists combined</returns>
        public static CompositeAction operator +(CompositeAction a, CompositeAction b)
        {
            CompositeAction toRet = new CompositeAction();

            if (a != null)
            {
                toRet.actions.UnionWith(a.actions);
            }
            if (b != null)
            {
                toRet.actions.UnionWith(b.actions);
            }
            return(toRet);
        }