Exemple #1
0
        public static CCLens3D actionWithPosition(CCPoint pos, float r, ccGridSize gridSize, float duration)
        {
            CCLens3D cCLens3D = new CCLens3D();

            if (cCLens3D.initWithPosition(pos, r, gridSize, duration))
            {
                return(cCLens3D);
            }
            return(null);
        }
Exemple #2
0
        /// <summary>
        /// creates the action with center position, radius, a grid size and duration
        /// </summary>
        public static CCLens3D actionWithPosition(CCPoint pos, float r, ccGridSize gridSize, float duration)
        {
            CCLens3D pAction = new CCLens3D();

            if (pAction.initWithPosition(pos, r, gridSize, duration))
            {
                return pAction;
            }

            return null;
        }
Exemple #3
0
        public override CCObject copyWithZone(CCZone pZone)
        {
            CCLens3D cCLens3D = null;

            if (pZone == null || pZone.m_pCopyObject == null)
            {
                cCLens3D = new CCLens3D();
                pZone    = new CCZone(cCLens3D);
            }
            else
            {
                cCLens3D = (CCLens3D)pZone.m_pCopyObject;
            }
            base.copyWithZone(pZone);
            cCLens3D.initWithPosition(this.m_position, this.m_fRadius, this.m_sGridSize, this.m_fDuration);
            return(cCLens3D);
        }
        /** creates the action with center position, radius, a grid size and duration */
        public static CCLens3D actionWithPosition(CCPoint pos, float r, ccGridSize gridSize, float duration)
        {
            CCLens3D pAction = new CCLens3D();

            if (pAction != null)
            {
                if (pAction.initWithPosition(pos, r, gridSize, duration))
                {
                    //pAction->autorelease();
                }
                else
                {
                    //CC_SAFE_RELEASE_NULL(pAction);
                }
            }

            return pAction;
        }
Exemple #5
0
        public override object Copy(ICopyable pZone)
        {
            CCLens3D pCopy;
            if (pZone != null)
            {
                // in case of being called at sub class
                pCopy = (CCLens3D) (pZone);
            }
            else
            {
                pCopy = new CCLens3D();
                pZone = pCopy;
            }

            base.Copy(pZone);

            pCopy.InitWithPosition(m_position, m_fRadius, m_sGridSize, m_fDuration);

            return pCopy;
        }
Exemple #6
0
        public override CCObject copyWithZone(CCZone pZone)
        {
            CCZone pNewZone = null;
            CCLens3D pCopy = null;
            if (pZone != null && pZone.m_pCopyObject != null)
            {
                // in case of being called at sub class
                pCopy = (CCLens3D)(pZone.m_pCopyObject);
            }
            else
            {
                pCopy = new CCLens3D();
                pZone = pNewZone = new CCZone(pCopy);
            }

            base.copyWithZone(pZone);

            pCopy.initWithPosition(m_position, m_fRadius, m_sGridSize, Duration);

            return pCopy;
        }
Exemple #7
0
        public override CCObject copyWithZone(CCZone pZone)
        {
            CCZone   pNewZone = null;
            CCLens3D pCopy    = null;

            if (pZone != null && pZone.m_pCopyObject != null)
            {
                // in case of being called at sub class
                pCopy = (CCLens3D)(pZone.m_pCopyObject);
            }
            else
            {
                pCopy = new CCLens3D();
                pZone = pNewZone = new CCZone(pCopy);
            }

            base.copyWithZone(pZone);

            pCopy.initWithPosition(m_position, m_fRadius, m_sGridSize, Duration);

            return(pCopy);
        }
Exemple #8
0
        public override void OnEnter()
        {
            base.OnEnter();

            CCLens3D lens = new CCLens3D(new CCPoint(100, 180), 150, new CCGridSize(32, 24), 10);
            CCJumpBy move = new CCJumpBy (5, new CCPoint(380, 0), 100, 4);
            var move_back = (CCActionInterval) move.Reverse();
            CCSequence seq = CCSequence.FromActions(move, move_back);

            /* In cocos2d-iphone, the type of action's target is 'id', so it supports using the instance of 'CCLens3D' as its target.
                While in cocos2d-x, the target of action only supports CCNode or its subclass,
                so we make an encapsulation for CCLens3D to achieve that.
            */

            CCDirector director = CCDirector.SharedDirector;
            CCNode target = Lens3DTarget.Create(lens);
            // Please make sure the target been added to its parent.
            AddChild(target);

            director.ActionManager.AddAction(seq, target, false);
            RunAction(lens);
        }
Exemple #9
0
        public override void OnEnter()
        {
            base.OnEnter();

            CCNode target = GetChildByTag(EffectAdvanceScene.kTagBackground);

            // To reuse a grid the grid size and the grid type must be the same.
            // in this case:
            //     Lens3D is Grid3D and it's size is (15,10)
            //     Waves3D is Grid3D and it's size is (15,10)

            CCSize size = CCDirector.SharedDirector.WinSize;
            CCActionInterval lens = new CCLens3D(new CCPoint(size.Width / 2, size.Height / 2), 240, new CCGridSize(15, 10), 0.0f);
            CCActionInterval waves = new CCWaves3D(18, 15, new CCGridSize(15, 10), 10);

            CCFiniteTimeAction reuse = new CCReuseGrid(1);
            CCActionInterval delay = new CCDelayTime (8);

            CCActionInterval orbit = new CCOrbitCamera(5, 1, 2, 0, 180, 0, -90);
            CCFiniteTimeAction orbit_back = orbit.Reverse();

            target.RunAction(new CCRepeatForever ((CCSequence.FromActions(orbit, orbit_back))));
            target.RunAction(CCSequence.FromActions(lens, delay, reuse, waves));
        }
Exemple #10
0
 public static Lens3DTarget Create(CCLens3D pAction)
 {
     var pRet = new Lens3DTarget();
     pRet.m_pLens3D = pAction;
     return pRet;
 }
Exemple #11
0
 public CCLens3D(CCLens3D lens3D)
 {
     InitWithPosition(lens3D.m_position, lens3D.m_fRadius, lens3D.m_sGridSize, lens3D.m_fDuration);
 }
Exemple #12
0
 public static CCLens3D Create(CCPoint pos, float r, CCGridSize gridSize, float duration)
 {
     var pAction = new CCLens3D();
     pAction.InitWithPosition(pos, r, gridSize, duration);
     return pAction;
 }