zoukankan      html  css  js  c++  java
  • 动作基类 CCAction

            CCAction动作基类关系

    class CC_DLL CCAction : public CCObject 
    {
    public:
        CCAction(void);
        virtual ~CCAction(void);
    
        const char* description();
    
        virtual CCObject* copyWithZone(CCZone *pZone);
    
        //! return true if the action has finished
        virtual bool isDone(void);
    
        //! called before the action start. It will also set the target.
        virtual void startWithTarget(CCNode *pTarget);
    
        /** 
        called after the action has finished. It will set the 'target' to nil.
        IMPORTANT: You should never call "[action stop]" manually. Instead, use: "target->stopAction(action);"
        */
        virtual void stop(void);
    
        //! called every frame with it's delta time. DON'T override unless you know what you are doing.
        virtual void step(float dt);
    
        /** 
        called once per frame. time a value between 0 and 1
    
        For example: 
        - 0 means that the action just started
        - 0.5 means that the action is in the middle
        - 1 means that the action is over
        */
        virtual void update(float time);
        
        inline CCNode* getTarget(void) { return m_pTarget; }
        /** The action will modify the target properties. */
        inline void setTarget(CCNode *pTarget) { m_pTarget = pTarget; }
        
        inline CCNode* getOriginalTarget(void) { return m_pOriginalTarget; } 
        /** Set the original target, since target can be nil.
        Is the target that were used to run the action. Unless you are doing something complex, like CCActionManager, you should NOT call this method.
        The target is 'assigned', it is not 'retained'.
        @since v0.8.2
        */
        inline void setOriginalTarget(CCNode *pOriginalTarget) { m_pOriginalTarget = pOriginalTarget; }
    
        inline int getTag(void) { return m_nTag; }
        inline void setTag(int nTag) { m_nTag = nTag; }
    
    public:
        /** Create an action */
        static CCAction* create();
    protected:
        CCNode    *m_pOriginalTarget;
        /** The "target".
        The target will be set with the 'startWithTarget' method.
        When the 'stop' method is called, target will be set to nil.
        The target is 'assigned', it is not 'retained'.
        */
        CCNode    *m_pTarget;
        /** The action tag. An identifier of the action */
        int     m_nTag;
    };

                即时动作的具体类

                持续动作类的结构图

    Dreams are one of those things that keep you going and happy!!!
  • 相关阅读:
    [转]JavaWeb学习总结(五十)——文件上传和下载
    [转]JavaWeb学习总结(四十九)——简单模拟Sping MVC
    [转]JavaWeb学习总结(四十八)——模拟Servlet3.0使用注解的方式配置Servlet
    [转]javaweb学习总结(四十七)——监听器(Listener)在开发中的应用
    [转]javaweb学习总结(四十六)——Filter(过滤器)常见应用
    [转]javaweb学习总结(四十五)——监听器(Listener)学习二
    js数组的方法
    神策埋点
    微信分享
    微信小程序
  • 原文地址:https://www.cnblogs.com/MrGreen/p/3269109.html
Copyright © 2011-2022 走看看