示例#1
0
        /// <summary>
        /// Creates an action group, a set which runs all actions in parallel
        /// </summary>
        /// <param name="owner">A reference to the owner of this action sequence.</param>
        /// <returns></returns>
        public static ActionSet Group(ActionsOwner owner)
        {
            // Construct the sequence
            ActionSet sequence = new ActionGroup();

            // Add it to the owner
            owner.Add(sequence);
            // Return it
            return(sequence);
        }
示例#2
0
        ActionsOwner SubscribeToActions(GameObject gameObj)
        {
            if (activeActions.ContainsKey(gameObj))
            {
                return(activeActions[gameObj]);
            }

            // If it has not already been added to the ActionSpace, do so
            if (!recentlyAddedActions.ContainsKey(gameObj))
            {
                //Trace.Script("'" + gameObj.name + "'");
                //Trace.Script("Adding '" + gameObj.name +  "' to the ActionSpace");
                if (Actions.debug)
                {
                    Trace.Script("Adding the GameObject to the ActionSpace");
                }

                var owner = new ActionsOwner(gameObj);
                recentlyAddedActions.Add(gameObj, owner);
                gameObj.AddComponent <ActionsRegistration>();
            }

            return(recentlyAddedActions[gameObj]);
        }
示例#3
0
 /// <summary>
 /// Cancels all active actions of the ActionsOwner.
 /// </summary>
 /// <param name="owner">A reference to the owner of this action sequence.</param>
 public static void Cancel(ActionsOwner owner)
 {
     owner.Clear();
 }