Esempio n. 1
0
        public override void Update(float time)
        {
            int i, j;

            for (i = 0; i < m_sGridSize.X; ++i)
            {
                for (j = 0; j < m_sGridSize.Y; ++j)
                {
                    CCQuad3 coords = OriginalTile(new CCGridSize(i, j));
                    // X
                    coords.BottomLeft.X  += (Random.Next() % (m_nRandrange * 2)) - m_nRandrange;
                    coords.BottomRight.X += (Random.Next() % (m_nRandrange * 2)) - m_nRandrange;
                    coords.TopLeft.X     += (Random.Next() % (m_nRandrange * 2)) - m_nRandrange;
                    coords.TopRight.X    += (Random.Next() % (m_nRandrange * 2)) - m_nRandrange;

                    // Y
                    coords.BottomLeft.Y  += (Random.Next() % (m_nRandrange * 2)) - m_nRandrange;
                    coords.BottomRight.Y += (Random.Next() % (m_nRandrange * 2)) - m_nRandrange;
                    coords.TopLeft.Y     += (Random.Next() % (m_nRandrange * 2)) - m_nRandrange;
                    coords.TopRight.Y    += (Random.Next() % (m_nRandrange * 2)) - m_nRandrange;

                    if (m_bShakeZ)
                    {
                        coords.BottomLeft.Z  += (Random.Next() % (m_nRandrange * 2)) - m_nRandrange;
                        coords.BottomRight.Z += (Random.Next() % (m_nRandrange * 2)) - m_nRandrange;
                        coords.TopLeft.Z     += (Random.Next() % (m_nRandrange * 2)) - m_nRandrange;
                        coords.TopRight.Z    += (Random.Next() % (m_nRandrange * 2)) - m_nRandrange;
                    }

                    SetTile(new CCGridSize(i, j), ref coords);
                }
            }
        }
Esempio n. 2
0
        public override void Update(float time)
        {
            // We may have started the action before the Visible Size was able
            // to be set from the Target so we will try it again
            if (width == 0)
            {
                VisibleSize = Target.VisibleBoundsWorldspace.Size;
                width       = VisibleSize.Width;
            }

            int j;

            for (j = 0; j < GridSize.Y; ++j)
            {
                CCQuad3 coords    = OriginalTile(0, j);
                float   direction = 1;

                if ((j % 2) == 0)
                {
                    direction = -1;
                }

                coords.BottomLeft.X  += direction * width * time;
                coords.BottomRight.X += direction * width * time;
                coords.TopLeft.X     += direction * width * time;
                coords.TopRight.X    += direction * width * time;

                SetTile(0, j, ref coords);
            }
        }
Esempio n. 3
0
        public override void Update(float time)
        {
            int i, j;

            var doubleRange = Range * 2;

            for (i = 0; i < GridSize.X; ++i)
            {
                for (j = 0; j < GridSize.Y; ++j)
                {
                    CCQuad3 coords = OriginalTile(i, j);
                    // X
                    coords.BottomLeft.X  += (CCRandom.Next() % doubleRange) - Range;
                    coords.BottomRight.X += (CCRandom.Next() % doubleRange) - Range;
                    coords.TopLeft.X     += (CCRandom.Next() % doubleRange) - Range;
                    coords.TopRight.X    += (CCRandom.Next() % doubleRange) - Range;

                    // Y
                    coords.BottomLeft.Y  += (CCRandom.Next() % doubleRange) - Range;
                    coords.BottomRight.Y += (CCRandom.Next() % doubleRange) - Range;
                    coords.TopLeft.Y     += (CCRandom.Next() % doubleRange) - Range;
                    coords.TopRight.Y    += (CCRandom.Next() % doubleRange) - Range;

                    if (ShakeZ)
                    {
                        coords.BottomLeft.Z  += (CCRandom.Next() % doubleRange) - Range;
                        coords.BottomRight.Z += (CCRandom.Next() % doubleRange) - Range;
                        coords.TopLeft.Z     += (CCRandom.Next() % doubleRange) - Range;
                        coords.TopRight.Z    += (CCRandom.Next() % doubleRange) - Range;
                    }

                    SetTile(i, j, ref coords);
                }
            }
        }
Esempio n. 4
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);
        }
Esempio n. 5
0
        protected void PlaceTile(int x, int y, CCTile tile)
        {
            CCQuad3 coords = OriginalTile(x, y);

            CCPoint step = 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(x, y, ref coords);
        }
Esempio n. 6
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);
        }
Esempio n. 7
0
        protected void PlaceTile(int x, int y, CCTile tile)
        {
            CCQuad3 coords = OriginalTile(x, y);

            var step = (Target is CCNodeGrid) ?  ((CCNodeGrid)Target).Grid.Step : 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(x, y, ref coords);
        }
Esempio n. 8
0
        public override void Update(float time)
        {
            int j;

            for (j = 0; j < m_sGridSize.Y; ++j)
            {
                CCQuad3 coords    = OriginalTile(new CCGridSize(0, j));
                float   direction = 1;

                if ((j % 2) == 0)
                {
                    direction = -1;
                }

                coords.BottomLeft.X  += direction * m_winSize.Width * time;
                coords.BottomRight.X += direction * m_winSize.Width * time;
                coords.TopLeft.X     += direction * m_winSize.Width * time;
                coords.TopRight.X    += direction * m_winSize.Width * time;

                SetTile(new CCGridSize(0, j), ref coords);
            }
        }
Esempio n. 9
0
        public override void Update(float time)
        {
            int i;

            for (i = 0; i < m_sGridSize.X; ++i)
            {
                CCQuad3 coords    = OriginalTile(new CCGridSize(i, 0));
                float   direction = 1;

                if ((i % 2) == 0)
                {
                    direction = -1;
                }

                coords.BottomLeft.Y  += direction * m_winSize.Height * time;
                coords.BottomRight.Y += direction * m_winSize.Height * time;
                coords.TopLeft.Y     += direction * m_winSize.Height * time;
                coords.TopRight.Y    += direction * m_winSize.Height * time;

                SetTile(new CCGridSize(i, 0), ref coords);
            }
        }
Esempio n. 10
0
        public void TurnOnTile(CCGridSize pos)
        {
            CCQuad3 orig = OriginalTile(pos);

            SetTile(pos, ref orig);
        }