Exemplo n.º 1
0
        public override void update(float time)
        {
            List <CCSpriteFrame> pFrames = m_pAnimation.getFrames();
            int numberOfFrames           = pFrames.Count;

            int idx = (int)(time * numberOfFrames);

            if (idx >= numberOfFrames)
            {
                idx = numberOfFrames - 1;
            }

            CCSprite pSprite = (CCSprite)(m_pTarget);

            if (!pSprite.isFrameDisplayed(pFrames[idx]))
            {
                pSprite.DisplayFrame = pFrames[idx];
            }
        }
Exemplo n.º 2
0
 public bool initWithAnimation(CCAnimation pAnimation, bool bRestoreOriginalFrame)
 {
     if (base.initWithDuration(pAnimation.getFrames().Count *pAnimation.getDelay()))
     {
         this.m_bRestoreOriginalFrame = bRestoreOriginalFrame;
         this.m_pAnimation            = pAnimation;
         this.m_pOrigFrame            = null;
         return(true);
     }
     return(false);
 }
Exemplo n.º 3
0
        // Animation

        /// <summary>
        /// changes the display frame with animation name and index.
        /// The animation name will be get from the CCAnimationCache
        /// @since v0.99.5
        /// </summary>
        public void setDisplayFrameWithAnimationName(string animationName, int frameIndex)
        {
            Debug.Assert(animationName != null);

            CCAnimation a = CCAnimationCache.sharedAnimationCache().animationByName(animationName);

            Debug.Assert(a != null);

            CCSpriteFrame frame = a.getFrames()[frameIndex];

            Debug.Assert(frame != null);

            DisplayFrame = frame;
        }
Exemplo n.º 4
0
        public bool initWithAnimation(CCAnimation pAnimation, bool bRestoreOriginalFrame)
        {
            Debug.Assert(pAnimation != null);

            if (base.initWithDuration(pAnimation.getFrames().Count * pAnimation.getDelay()))
            {
                m_bRestoreOriginalFrame = bRestoreOriginalFrame;
                m_pAnimation = pAnimation;
                m_pOrigFrame = null;

                return true;
            }

            return false;
        }
Exemplo n.º 5
0
        public bool initWithAnimation(CCAnimation pAnimation, bool bRestoreOriginalFrame)
        {
            Debug.Assert(pAnimation != null);

            if (base.initWithDuration(pAnimation.getFrames().Count *pAnimation.getDelay()))
            {
                m_bRestoreOriginalFrame = bRestoreOriginalFrame;
                m_pAnimation            = pAnimation;
                m_pOrigFrame            = null;

                return(true);
            }

            return(false);
        }