Cocos Code Study (one) ActionManager class learning Notes

Source: Internet
Author: User

Theoretical part

ActionManager is a singleton class that manages all actions. Usually you don't need to use this class directly. In most cases, you will use node's interface, which provides a more friendly package but there are some cases where you might need to use this singleton. Example:

    • When you want to run an action, but the target is not a node type.
    • When you want to pause/resume the action.
Code section

void Addaction (Action *action, Node *target, BOOL paused)
Adds an action that also needs to provide the target object for the action and whether the target object is paused as a parameter. When the target State paused to true, the action will not be executed.

Instance:

    Auto Director = director::getinstance ();    Directortrue);

void Removeallactions ()
Deletes all actions for all target objects.

void Removeallactionsfromtarget (Node *target)
Remove all actions from a specific target. All actions that are part of the target will be deleted.

void Removeaction (Action *action)
Deletes an action.

void Removeactionbytag (int tag, Node *target)
Deleting an action for a specific tag tag under the target object will delete the first match to the action.

void Removeallactionsbytag (int tag, Node *target)
Removes all actions for a specific tag tag under the target object.

void removeactionsbyflags (unsigned int flags, Node *target)
Delete a specific tag group action under a target object

Action * Getactionbytag (int tag, const Node *target) const
Gets an action from the target object and tag.

ssize_t getnumberofrunningactionsintarget (const Node *target) const
Returns the number of all running actions under the specified target. A combined action is counted as an action. Example:

ssize_t Numberofrunningactionsintarget (Node *target) const
void Pausetarget (Node *target)
Pause target object: All running actions and newly added actions will be paused.

void Resumetarget (Node *target)
Let the target object resume running. All paused actions in the execution sequence will resume running.

Instance:

    Auto Director = director::getinstance ();    Director->getactionmanager ()->resumetarget (node);



vector< Node * > Pauseallrunningactions ()
Pauses all running actions, returning a list of target objects to which an action is paused.

void Resumetargets (const vector< Node * > &targetstoresume)
Let a set of target objects resume running.

Cocos Code Study (one) ActionManager class learning Notes

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.