public void placeTile(int x, int y, Tile t)
        {
            ccQuad3 coords = originalTile(x,y);
            if (coords == null)
            {
                return;
            }

            CCPoint step = m_pTarget.Grid.Step;
            coords.bl.x += (int)(t.position.x * step.x);
            coords.bl.y += (int)(t.position.y * step.y);

            coords.br.x += (int)(t.position.x * step.x);
            coords.br.y += (int)(t.position.y * step.y);

            coords.tl.x += (int)(t.position.x * step.x);
            coords.tl.y += (int)(t.position.y * step.y);

            coords.tr.x += (int)(t.position.x * step.x);
            coords.tr.y += (int)(t.position.y * step.y);

            setTile(x,y, coords);
        }
Esempio n. 2
0
        public override void startWithTarget(CCNode pTarget)
        {
            base.startWithTarget(pTarget);

            if (m_nSeed != -1)
            {
                m_nSeed = new Random().Next();
            }

            m_nTilesCount = m_sGridSize.x * m_sGridSize.y;
            m_pTilesOrder = new int[m_nTilesCount];
            int i, j;
            int k;

            /**
             * Use k to loop. Because m_nTilesCount is unsigned int,
             * and i is used later for int.
             */
            for (k = 0; k < m_nTilesCount; ++k)
            {
                m_pTilesOrder[k] = k;
            }

            shuffle(ref m_pTilesOrder, m_nTilesCount);

            m_pTiles = new Tile[m_nTilesCount];

            int f = 0;
            for (i = 0; i < m_sGridSize.x; ++i)
            {
                for (j = 0; j < m_sGridSize.y; ++j)
                {
                    m_pTiles[f] = new Tile();
                    m_pTiles[f].position = new CCPoint((float)i, (float)j);
                    m_pTiles[f].startPosition = new CCPoint((float)i, (float)j);
                    m_pTiles[f].delta = getDelta(new ccGridSize(i, j));

                    f++;
                }
            }
        }
Esempio n. 3
0
        public void placeTile(ccGridSize pos, Tile t)
        {
            ccQuad3 coords = originalTile(pos);

            CCPoint step = m_pTarget.Grid.Step;
            coords.bl.x += (int)(t.position.x * step.x);
            coords.bl.y += (int)(t.position.y * step.y);

            coords.br.x += (int)(t.position.x * step.x);
            coords.br.y += (int)(t.position.y * step.y);

            coords.tl.x += (int)(t.position.x * step.x);
            coords.tl.y += (int)(t.position.y * step.y);

            coords.tr.x += (int)(t.position.x * step.x);
            coords.tr.y += (int)(t.position.y * step.y);

            setTile(pos, coords);
        }
 public void placeTile(ccGridSize pos, Tile t)
 {
     placeTile(pos.x, pos.y, t);
 }