public CCShuffleTilesState (CCShuffleTiles action, CCNode target) : base (action, target)
        {
            CCGridSize gridSize = action.GridSize;
            TilesCount = gridSize.X * gridSize.Y;
            int[] shuffledTilesOrder = new int[TilesCount];
            int i, j, f = 0;

            for (i = 0; i < TilesCount; i++) {
                shuffledTilesOrder [i] = i;
            }

            if (action.Seed != CCShuffleTiles.NoSeedSpecified) {
                CCRandom.Next (action.Seed);
            }


            Shuffle (ref shuffledTilesOrder, TilesCount);
            TilesOrder = shuffledTilesOrder;

            Tiles = new CCTile[TilesCount];

            for (i = 0; i < gridSize.X; ++i) {
                for (j = 0; j < gridSize.Y; ++j) {
                    Tiles [f] = new CCTile {
                        Position = new CCPoint (i, j),
                        StartPosition = new CCPoint (i, j),
                        Delta = GetDelta (i, j)
                    };

                    f++;
                }
            }
        }
Exemple #2
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:
            //     ShakyTiles is TiledGrid3D and it's size is (15,10)
            //     Shuffletiles is TiledGrid3D and it's size is (15,10)
            //	   TurnOfftiles is TiledGrid3D and it's size is (15,10)
            CCActionInterval   shaky   = new CCShakyTiles3D(4, false, new CCGridSize(15, 10), 5);
            CCActionInterval   shuffle = new CCShuffleTiles(0, new CCGridSize(15, 10), 3);
            CCActionInterval   turnoff = new CCTurnOffTiles(0, new CCGridSize(15, 10), 3);
            CCFiniteTimeAction turnon  = turnoff.Reverse();

            // reuse 2 times:
            //   1 for shuffle
            //   2 for turn off
            //   turnon tiles will use a new grid
            CCFiniteTimeAction reuse = new CCReuseGrid(2);

            CCActionInterval delay = new CCDelayTime(1);

            //	id orbit = [OrbitCamera::actionWithDuration:5 radius:1 deltaRadius:2 angleZ:0 deltaAngleZ:180 angleX:0 deltaAngleX:-90];
            //	id orbit_back = [orbit reverse];
            //
            //	[target runAction: [RepeatForever::actionWithAction: [Sequence actions: orbit, orbit_back, nil]]];
            target.RunAction((CCSequence.FromActions(shaky, delay, reuse, shuffle, (CCFiniteTimeAction)delay.Copy(), turnoff, turnon)));
        }
Exemple #3
0
        public override void OnEnter()
        {
            base.OnEnter();

            // To reuse a grid the grid size and the grid type must be the same.
            // in this case:
            //     ShakyTiles is TiledGrid3D and it's size is (15,10)
            //     Shuffletiles is TiledGrid3D and it's size is (15,10)
            //	   TurnOfftiles is TiledGrid3D and it's size is (15,10)
            var shaky   = new CCShakyTiles3D(5, new CCGridSize(15, 10), 4, false);
            var shuffle = new CCShuffleTiles(new CCGridSize(15, 10), 3, 0);
            var turnoff = new CCTurnOffTiles(3, new CCGridSize(15, 10), 0);
            var turnon  = turnoff.Reverse();

            // reuse 2 times:
            //   1 for shuffle
            //   2 for turn off
            //   turnon tiles will use a new grid
            var reuse = new CCReuseGrid(2);

            var delay = new CCDelayTime(1);

            //	id orbit = [OrbitCamera::actionWithDuration:5 radius:1 deltaRadius:2 angleZ:0 deltaAngleZ:180 angleX:0 deltaAngleX:-90];
            //	id orbit_back = [orbit reverse];
            //
            //	[target runAction: [RepeatForever::actionWithAction: [Sequence actions: orbit, orbit_back, nil]]];
            bgNode.RunActions(shaky, delay, reuse, shuffle, delay, turnoff, turnon);
        }
Exemple #4
0
        public new static CCActionInterval actionWithDuration(float t)
        {
            CCShuffleTiles     shuffle      = new CCShuffleTiles(25, new CCGridSize(16, 12), t);
            CCFiniteTimeAction shuffle_back = shuffle.Reverse();
            CCDelayTime        delay        = new CCDelayTime(2);

            return((CCActionInterval)(CCSequence.FromActions(shuffle, delay, shuffle_back)));
        }
        public static CCFiniteTimeAction ActionWithDuration(float t)
        {
            var shuffle      = new CCShuffleTiles(new CCGridSize(16, 12), t, 25);
            var shuffle_back = shuffle.Reverse();
            var delay        = new CCDelayTime(2);

            return(new CCSequence(shuffle, delay, shuffle_back));
        }
        public override object Copy(ICopyable pZone)
        {
            CCShuffleTiles pCopy;
            if (pZone != null)
            {
                pCopy = (CCShuffleTiles) (pZone);
            }
            else
            {
                pCopy = new CCShuffleTiles();
                pZone =  (pCopy);
            }

            base.Copy(pZone);

            pCopy.InitWithSeed(m_nSeed, m_sGridSize, m_fDuration);

            return pCopy;
        }
        public override object Copy(ICopyable pZone)
        {
            CCShuffleTiles pCopy;
            if (pZone != null)
            {
                pCopy = (CCShuffleTiles) (pZone);
            }
            else
            {
                pCopy = new CCShuffleTiles();
                pZone =  (pCopy);
            }

            base.Copy(pZone);

            pCopy.InitWithSeed(m_nSeed, m_sGridSize, m_fDuration);

            return pCopy;
        }
Exemple #8
0
        public CCShuffleTilesState(CCShuffleTiles action, CCNode target) : base(action, target)
        {
            CCGridSize gridSize = action.GridSize;

            TilesCount = gridSize.X * gridSize.Y;
            int[] shuffledTilesOrder = new int[TilesCount];
            int   i, j, f = 0;

            for (i = 0; i < TilesCount; i++)
            {
                shuffledTilesOrder [i] = i;
            }

            if (action.Seed != CCShuffleTiles.NoSeedSpecified)
            {
                CCRandom.Next(action.Seed);
            }


            Shuffle(ref shuffledTilesOrder, TilesCount);
            TilesOrder = shuffledTilesOrder;

            Tiles = new CCTile[TilesCount];

            for (i = 0; i < gridSize.X; ++i)
            {
                for (j = 0; j < gridSize.Y; ++j)
                {
                    Tiles [f] = new CCTile {
                        Position      = new CCPoint(i, j),
                        StartPosition = new CCPoint(i, j),
                        Delta         = GetDelta(i, j)
                    };

                    f++;
                }
            }
        }
 /// <summary>
 /// creates the action with a random seed, the grid size and the duration 
 /// </summary>
 public static CCShuffleTiles Create(int s, CCGridSize gridSize, float duration)
 {
     var pAction = new CCShuffleTiles();
     pAction.InitWithSeed(s, gridSize, duration);
     return pAction;
 }
Exemple #10
0
        public static new CCSequence ActionWithDuration(ccTime t)
        {
            var shuffle = new CCShuffleTiles (25, new ccGridSize (16, 12), t);
            var shuffle_back = shuffle.Reverse ();
            var delay = new CCDelayTime (2);

            return (CCSequence)CCSequence.Actions (shuffle, delay, shuffle_back);
        }