Exemple #1
0
        private void CreateGameOver()
        {
            _gameOverGems = new List <GameOverGem>();

            for (var x = 0; x < Constants.KBoardWidth; x++)
            {
                var column = _fallingGems[x];
                for (var i = 0; i < column.Count; i++)
                {
                    var gem = column[i];

                    var ySpeed = (float)(CCRandom.NextDouble() * 2 - 1) * Constants.KGameOverGemSpeed;
                    var xSpeed = (float)(CCRandom.NextDouble() * 2 - 1) * Constants.KGameOverGemSpeed;

                    var gameOverGem = new GameOverGem()
                    {
                        sprite = gem.sprite, xPos = x, yPos = gem.yPos, ySpeed = ySpeed, xSpeed = xSpeed
                    };
                    _gameOverGems.Add(gameOverGem);
                }

                for (var y = 0; y < Constants.KBoardHeight; y++)
                {
                    var i1 = x + y * Constants.KBoardWidth;
                    if (_boardSprites[i1] != null)
                    {
                        var ySpeed1      = (float)(CCRandom.NextDouble() * 2 - 1) * Constants.KGameOverGemSpeed;
                        var xSpeed1      = (float)(CCRandom.NextDouble() * 2 - 1) * Constants.KGameOverGemSpeed;
                        var gameOverGem1 = new GameOverGem()
                        {
                            sprite = _boardSprites[i1], xPos = x, yPos = y, ySpeed = ySpeed1, xSpeed = xSpeed1
                        };
                        _gameOverGems.Add(gameOverGem1);
                    }
                }
            }

            _hintLayer.RemoveAllChildrenWithCleanup(true);

            RemoveShimmer();
        }
Exemple #2
0
        public void reparentSprite(float dt)
        {
            CCNode p1 = GetChildByTag((int)kTags.kTagNode);
            CCNode p2 = GetChildByTag((int)kTags.kTagSpriteBatchNode);

            List <CCNode> retArray = new List <CCNode>(250);

            if (m_usingSpriteBatchNode)
            {
                CCNode tmp = p1;
                p1 = p2;
                p2 = tmp;
            }

            ////----UXLOG("New parent is: %x", p2);

            CCNode node;
            var    children = p1.Children;

            foreach (var item in children)
            {
                if (item == null)
                {
                    break;
                }
                retArray.Add(item);
            }

            int i = 0;

            p1.RemoveAllChildrenWithCleanup(false);

            foreach (var item in retArray)
            {
                if (item == null)
                {
                    break;
                }
                p2.AddChild(item, i, i);
                i++;
            }
            m_usingSpriteBatchNode = !m_usingSpriteBatchNode;
        }