Example #1
0
        public CCGridSize GetDelta(CCGridSize pos)
        {
            var pos2 = new CCPoint();

            int idx = pos.X * m_sGridSize.Y + pos.Y;

            pos2.X = (m_pTilesOrder[idx] / m_sGridSize.Y);
            pos2.Y = (m_pTilesOrder[idx] % m_sGridSize.Y);

            return(new CCGridSize((int)(pos2.X - pos.X), (int)(pos2.Y - pos.Y)));
        }
Example #2
0
        public CCGridSize GetDelta(CCGridSize pos)
        {
            var pos2 = new CCPoint();

            int idx = pos.X * m_sGridSize.Y + pos.Y;

            pos2.X = (m_pTilesOrder[idx] / m_sGridSize.Y);
            pos2.Y = (m_pTilesOrder[idx] % m_sGridSize.Y);

            return new CCGridSize((int) (pos2.X - pos.X), (int) (pos2.Y - pos.Y));
        }
Example #3
0
        /// <summary>
        /// initializes the action with a random seed, the grid size and the duration
        /// </summary>
        protected virtual bool InitWithDuration(float duration, CCGridSize gridSize, int seed)
        {
            if (base.InitWithDuration(duration, gridSize))
            {
                m_nSeed       = seed;
                m_pTilesOrder = null;

                return(true);
            }

            return(false);
        }
Example #4
0
        public bool InitWithRange(int range, bool shakeZ, CCGridSize gridSize, float duration)
        {
            if (base.InitWithSize(gridSize, duration))
            {
                m_nRandrange = range;
                m_bShakeZ = shakeZ;

                return true;
            }

            return false;
        }
Example #5
0
        /// <summary>
        /// initializes the action with a random seed, the grid size and the duration
        /// </summary>
        protected virtual bool InitWithSeed(int s, CCGridSize gridSize, float duration)
        {
            if (base.InitWithSize(gridSize, duration))
            {
                m_nSeed       = s;
                m_pTilesOrder = null;

                return(true);
            }

            return(false);
        }
Example #6
0
        /// <summary>
        ///  initializes the action with a range, whether or not to shake Z vertices, a grid size, and duration
        /// </summary>
        protected virtual bool InitWithDuration(float duration, CCGridSize gridSize, int nRange, bool bShakeZ)
        {
            if (base.InitWithDuration(duration, gridSize))
            {
                m_nRandrange = nRange;
                m_bShakeZ    = bShakeZ;

                return(true);
            }

            return(false);
        }
Example #7
0
        protected virtual bool InitWithRange(int range, bool shakeZ, CCGridSize gridSize, float duration)
        {
            if (base.InitWithSize(gridSize, duration))
            {
                m_nRandrange = range;
                m_bShakeZ    = shakeZ;

                return(true);
            }

            return(false);
        }
        /// <summary>
        /// initializes the action with a random seed, the grid size and the duration 
        /// </summary>
        protected virtual bool InitWithSeed(int s, CCGridSize gridSize, float duration)
        {
            if (base.InitWithSize(gridSize, duration))
            {
                m_nSeed = s;
                m_pTilesOrder = null;

                return true;
            }

            return false;
        }
Example #9
0
        /// <summary>
        ///  initializes the action with a range, whether or not to shake Z vertices, a grid size, and duration
        /// </summary>
        protected virtual bool InitWithDuration(float duration, CCGridSize gridSize, int nRange, bool bShakeZ)
        {
            if (base.InitWithDuration(duration, gridSize))
            {
                m_nRandrange = nRange;
                m_bShakeZ = bShakeZ;

                return true;
            }

            return false;
        }
Example #10
0
        /// <summary>
        /// initializes the action with a random seed, the grid size and the duration 
        /// </summary>
        protected virtual bool InitWithDuration(float duration, CCGridSize gridSize, int seed)
        {
            if (base.InitWithDuration(duration, gridSize))
            {
                m_nSeed = seed;
                m_pTilesOrder = null;

                return true;
            }

            return false;
        }
Example #11
0
        protected CCGridSize GetDelta(CCGridSize pos)
        {
            var pos2 = CCPoint.Zero;

            int idx       = pos.X * GridSize.Y + pos.Y;
            int tileOrder = TilesOrder [idx];

            pos2.X = (tileOrder / GridSize.Y);
            pos2.Y = (tileOrder % GridSize.Y);

            return(new CCGridSize((int)(pos2.X - pos.X), (int)(pos2.Y - pos.Y)));
        }
Example #12
0
        /// <summary>
        /// initializes the action with a range, whether or not to shatter Z vertices, a grid size and duration
        /// </summary>
        protected virtual bool InitWithRange(int nRange, bool bShatterZ, CCGridSize gridSize, float duration)
        {
            if (base.InitWithSize(gridSize, duration))
            {
                m_bOnce      = false;
                m_nRandrange = nRange;
                m_bShatterZ  = bShatterZ;

                return(true);
            }

            return(false);
        }
        /// <summary>
        /// initializes the action with a range, whether or not to shatter Z vertices, a grid size and duration
        /// </summary>
        protected virtual bool InitWithRange(int nRange, bool bShatterZ, CCGridSize gridSize, float duration)
        {
            if (base.InitWithSize(gridSize, duration))
            {
                m_bOnce = false;
                m_nRandrange = nRange;
                m_bShatterZ = bShatterZ;

                return true;
            }

            return false;
        }
 public CCActionInterval ActionWithSize(CCGridSize vector)
 {
     if (m_bBack)
     {
         // Get hold of the PageTurn3DAction
         return new CCReverseTime
             (
                 CCPageTurn3D.Create(vector, m_fDuration)
             );
     }
     else
     {
         // Get hold of the PageTurn3DAction
         return CCPageTurn3D.Create(vector, m_fDuration);
     }
 }
Example #15
0
 public CCFiniteTimeAction ActionWithSize(CCGridSize vector)
 {
     if (Back)
     {
         // Get hold of the PageTurn3DAction
         return(new CCReverseTime
                (
                    new CCPageTurn3D(Duration, vector)
                ));
     }
     else
     {
         // Get hold of the PageTurn3DAction
         return(new CCPageTurn3D(Duration, vector));
     }
 }
Example #16
0
 public CCActionInterval ActionWithSize(CCGridSize vector)
 {
     if (m_bBack)
     {
         // Get hold of the PageTurn3DAction
         return(new CCReverseTime
                (
                    new CCPageTurn3D(vector, m_fDuration)
                ));
     }
     else
     {
         // Get hold of the PageTurn3DAction
         return(new CCPageTurn3D(vector, m_fDuration));
     }
 }
Example #17
0
        public void PlaceTile(CCGridSize pos, CCTile t)
        {
            CCQuad3 coords = OriginalTile(pos);

            CCPoint step = m_pTarget.Grid.Step;
            coords.BottomLeft.X += (int) (t.Position.X * step.X);
            coords.BottomLeft.Y += (int) (t.Position.Y * step.Y);

            coords.BottomRight.X += (int) (t.Position.X * step.X);
            coords.BottomRight.Y += (int) (t.Position.Y * step.Y);

            coords.TopLeft.X += (int) (t.Position.X * step.X);
            coords.TopLeft.Y += (int) (t.Position.Y * step.Y);

            coords.TopRight.X += (int) (t.Position.X * step.X);
            coords.TopRight.Y += (int) (t.Position.Y * step.Y);

            SetTile(pos, ref coords);
        }
Example #18
0
        public void PlaceTile(CCGridSize pos, CCTile t)
        {
            CCQuad3 coords = OriginalTile(pos);

            CCPoint step = m_pTarget.Grid.Step;
            coords.BottomLeft.X += (int) (t.Position.X * step.X);
            coords.BottomLeft.Y += (int) (t.Position.Y * step.Y);

            coords.BottomRight.X += (int) (t.Position.X * step.X);
            coords.BottomRight.Y += (int) (t.Position.Y * step.Y);

            coords.TopLeft.X += (int) (t.Position.X * step.X);
            coords.TopLeft.Y += (int) (t.Position.Y * step.Y);

            coords.TopRight.X += (int) (t.Position.X * step.X);
            coords.TopRight.Y += (int) (t.Position.Y * step.Y);

            SetTile(pos, ref coords);
        }
Example #19
0
        protected void PlaceTile(CCGridSize pos, CCTile tile)
        {
            CCQuad3 coords = OriginalTile(pos);

            var step = ((CCNodeGrid)Target).Grid.Step;

            coords.BottomLeft.X += (int)(tile.Position.X * step.X);
            coords.BottomLeft.Y += (int)(tile.Position.Y * step.Y);

            coords.BottomRight.X += (int)(tile.Position.X * step.X);
            coords.BottomRight.Y += (int)(tile.Position.Y * step.Y);

            coords.TopLeft.X += (int)(tile.Position.X * step.X);
            coords.TopLeft.Y += (int)(tile.Position.Y * step.Y);

            coords.TopRight.X += (int)(tile.Position.X * step.X);
            coords.TopRight.Y += (int)(tile.Position.Y * step.Y);

            SetTile(pos, ref coords);
        }
Example #20
0
        public CCTurnOffTilesState(CCTurnOffTiles action, CCNodeGrid target) : base(action, target)
        {
            int i;

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

            CCGridSize gridSize = action.GridSize;

            TilesCount = gridSize.X * gridSize.Y;
            TilesOrder = new int[TilesCount];

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

            Shuffle(TilesOrder, TilesCount);
        }
Example #21
0
        public override void Update(float time)
        {
            int i, l, t;

            l = (int)(time * m_nTilesCount);

            for (i = 0; i < m_nTilesCount; i++)
            {
                t = m_pTilesOrder[i];
                var tilePos = new CCGridSize(t / m_sGridSize.Y, t % m_sGridSize.Y);

                if (i < l)
                {
                    TurnOffTile(tilePos);
                }
                else
                {
                    TurnOnTile(tilePos);
                }
            }
        }
Example #22
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++;
                }
            }
        }
Example #23
0
 protected override CCFiniteTimeAction CreateAction(CCGridSize size)
 {
     return new CCFadeOutUpTiles(Duration, size);
 }
Example #24
0
 public void TurnOnTile(CCGridSize pos)
 {
     CCQuad3 orig = OriginalTile(pos);
     SetTile(pos, ref orig);
 }
 protected override CCFiniteTimeAction CreateAction(CCGridSize size)
 {
     return(new CCFadeOutUpTiles(Duration, size));
 }
 /// <summary>
 /// creates the action with a range, whether of not to shatter Z vertices, a grid size and duration
 /// </summary>
 public CCShatteredTiles3D(int nRange, bool bShatterZ, CCGridSize gridSize, float duration) : base(duration)
 {
     InitWithRange(nRange, bShatterZ, gridSize, duration);
 }
 public override CCActionInterval CreateAction(CCGridSize size)
 {
     return(new CCFadeOutDownTiles(m_fDuration, size));
 }
Example #28
0
 /// <summary>
 /// creates the action with a range, whether or not to shake Z vertices, a grid size, and duration
 /// </summary>
 public CCShakyTiles3D(float duration, CCGridSize gridSize, int nRange, bool bShakeZ) : base(duration)
 {
     InitWithDuration(duration, gridSize, nRange, bShakeZ);
 }
Example #29
0
 public override CCActionInterval CreateAction(CCGridSize size)
 {
     return new CCFadeOutUpTiles(m_fDuration, size);
 }
Example #30
0
        public void TurnOnTile(CCGridSize pos)
        {
            CCQuad3 orig = OriginalTile(pos);

            SetTile(pos, ref orig);
        }
Example #31
0
 /// <summary>
 /// creates the action with a range, whether of not to shatter Z vertices, a grid size and duration
 /// </summary>
 public CCShatteredTiles3D(int nRange, bool bShatterZ, CCGridSize gridSize, float duration) : base(duration)
 {
     InitWithRange(nRange, bShatterZ, gridSize, duration);
 }
Example #32
0
 public CCShaky3D (float duration, CCGridSize gridSize, int range = 0, bool shakeZ = true)
     : base (duration, gridSize)
 {
     Range = range;
     Shake = shakeZ;
 }
 public override CCActionInterval CreateAction(CCGridSize size)
 {
     return CCFadeOutDownTiles.Create(size, m_fDuration);
 }
Example #34
0
 public CCShaky3D(int range, bool shakeZ, CCGridSize gridSize, float duration)
     : base(duration)
 {
     InitWithRange(range, shakeZ, gridSize, duration);
 }
Example #35
0
 /// <summary>
 /// creates the action with a random seed, the grid size and the duration 
 /// </summary>
 public CCTurnOffTiles (float duration, CCGridSize gridSize, int seed = CCShuffleTiles.NoSeedSpecified)
     : base (gridSize, duration, seed)
 {
 }
Example #36
0
 /// <summary>
 /// creates the action with a random seed, the grid size and the duration
 /// </summary>
 public CCTurnOffTiles(float duration, CCGridSize gridSize, int seed) : base(duration)
 {
     InitWithDuration(duration, gridSize, seed);
 }
 protected virtual CCFiniteTimeAction CreateAction(CCGridSize size)
 {
     return(new CCFadeOutTRTiles(Duration, size));
 }
Example #38
0
 public virtual CCActionInterval CreateAction(CCGridSize size)
 {
     return new CCFadeOutTRTiles(m_fDuration, size);
 }
Example #39
0
 public void TurnOffTile(CCGridSize pos)
 {
     SetTile(pos, ref m_pZero);
 }
Example #40
0
 /// <summary>
 /// creates the action with a random seed, the grid size and the duration 
 /// </summary>
 public CCTurnOffTiles(float duration, CCGridSize gridSize, int seed) : base(duration)
 {
     InitWithDuration(duration, gridSize, seed);
 }
Example #41
0
 /// <summary>
 /// creates the action with a random seed, the grid size and the duration 
 /// </summary>
 public CCShuffleTiles(CCGridSize gridSize, float duration, int seed) : base(duration)
 {
     InitWithDuration(duration, gridSize, seed);
 }
Example #42
0
 /// <summary>
 /// creates the action with a random seed, the grid size and the duration
 /// </summary>
 public CCShuffleTiles(CCGridSize gridSize, float duration, int seed) : base(duration)
 {
     InitWithDuration(duration, gridSize, seed);
 }
 public virtual CCActionInterval CreateAction(CCGridSize size)
 {
     return CCFadeOutTRTiles.Create(size, m_fDuration);
 }
 public virtual CCActionInterval CreateAction(CCGridSize size)
 {
     return(new CCFadeOutTRTiles(m_fDuration, size));
 }
Example #45
0
 /// <summary>
 /// creates the action with a range, whether of not to shatter Z vertices, a grid size and duration
 /// </summary>
 public CCShatteredTiles3D (float duration, CCGridSize gridSize, int range = 0, bool shatterZ = true) : base (duration, gridSize)
 {
     Range = range;
     ShatterZ = shatterZ;
 }
Example #46
0
        public override void Update(float time)
        {
            int i, l, t;

            l = (int) (time * m_nTilesCount);

            for (i = 0; i < m_nTilesCount; i++)
            {
                t = m_pTilesOrder[i];
                var tilePos = new CCGridSize(t / m_sGridSize.Y, t % m_sGridSize.Y);

                if (i < l)
                {
                    TurnOffTile(tilePos);
                }
                else
                {
                    TurnOnTile(tilePos);
                }
            }
        }
Example #47
0
 /// <summary>
 /// creates the action with a random seed, the grid size and the duration 
 /// </summary>
 public CCTurnOffTiles(int s, CCGridSize gridSize, float duration) : base(duration)
 {
     InitWithSeed(s, gridSize, duration);
 }
 public override CCActionInterval CreateAction(CCGridSize size)
 {
     return(new CCFadeOutBLTiles(size, m_fDuration));
 }
Example #49
0
 public override CCActionInterval CreateAction(CCGridSize size)
 {
     return new CCFadeOutBLTiles(size, m_fDuration);
 }
Example #50
0
 protected virtual CCFiniteTimeAction CreateAction(CCGridSize size)
 {
     return new CCFadeOutTRTiles(Duration, size);
 }
Example #51
0
 /// <summary>
 /// creates the action with a range, whether or not to shake Z vertices, a grid size, and duration
 /// </summary>
 public static CCShakyTiles3D Create(int nRange, bool bShakeZ, CCGridSize gridSize, float duration)
 {
     var pAction = new CCShakyTiles3D();
     pAction.InitWithRange(nRange, bShakeZ, gridSize, duration);
     return pAction;
 }
Example #52
0
 /// <summary>
 /// creates the action with a random seed, the grid size and the duration
 /// </summary>
 public CCTurnOffTiles(float duration, CCGridSize gridSize, int seed = CCShuffleTiles.NoSeedSpecified)
     : base(gridSize, duration, seed)
 {
 }
Example #53
0
 /// <summary>
 /// creates the action with the grid size and the duration
 /// </summary>
 public CCTurnOffTiles(CCGridSize size, float d)  :base(d)
 {
     InitWithSize(size, d);
 }
Example #54
0
 /// <summary>
 /// creates the action with the grid size and the duration
 /// </summary>
 public CCTurnOffTiles(CCGridSize size, float d)  : base(d)
 {
     InitWithSize(size, d);
 }
Example #55
0
 /// <summary>
 /// creates the action with a range, whether of not to shatter Z vertices, a grid size and duration
 /// </summary>
 public CCShatteredTiles3D(float duration, CCGridSize gridSize, int nRange, bool bShatterZ) : base(duration)
 {
     InitWithDuration(duration, gridSize, nRange, bShatterZ);
 }
Example #56
0
 /// <summary>
 /// creates the action with a random seed, the grid size and the duration
 /// </summary>
 public CCTurnOffTiles(int s, CCGridSize gridSize, float duration) : base(duration)
 {
     InitWithSeed(s, gridSize, duration);
 }
Example #57
0
 public void TurnOffTile(CCGridSize pos)
 {
     SetTile(pos, ref m_pZero);
 }
Example #58
0
 public CCShaky3D(float duration, CCGridSize gridSize, int range = 0, bool shakeZ = true)
     : base(duration, gridSize)
 {
     Range = range;
     Shake = shakeZ;
 }
Example #59
0
 /// <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;
 }
Example #60
0
 /// <summary>
 /// creates the action with a random seed, the grid size and the duration
 /// </summary>
 public CCShuffleTiles(CCGridSize gridSize, float duration, int seed = NoSeedSpecified)
     : base(duration, gridSize)
 {
 }