Пример #1
0
        private SmashBlock CreateSmashBlock(XElement node)
        {
            SmashBlock newSmashBlock;

            if (Data.Profile.PlayingRaceMode)
            {
                newSmashBlock = new RaceModePowerUpSmashBlock();
                ((RaceModePowerUpSmashBlock)newSmashBlock).TickCallback = _registerTimerTick;
                ((RaceModePowerUpSmashBlock)newSmashBlock).RegenerationParticleEffect = _smashBlockRegenerationCallback;
            }
            else
            {
                newSmashBlock = new SurvivalModeItemSmashBlock();
            }

            newSmashBlock.WorldPosition = new Vector2((float)node.Attribute("x"), (float)node.Attribute("y"));
            newSmashBlock.SmashCallback = _smashBlockCallback;

            foreach (XElement el in node.Elements("contains-item"))
            {
                Data.SmashBlockItemData item = CreateSmashBlockItem(el, newSmashBlock.WorldPosition);
                if (item != null)
                {
                    newSmashBlock.Contents.Add(item);
                }
            }

            return(newSmashBlock);
        }
Пример #2
0
        private SmashBlock CreateSmashBlock(XElement node)
        {
            SmashBlock newSmashBlock;

            if (Data.Profile.PlayingRaceMode)
            {
                newSmashBlock = new RaceModePowerUpSmashBlock();
                ((RaceModePowerUpSmashBlock)newSmashBlock).TickCallback = _registerTimerTick;
                ((RaceModePowerUpSmashBlock)newSmashBlock).RegenerationParticleEffect = _smashBlockRegenerationCallback;
            }
            else
            {
                newSmashBlock = new SurvivalModeItemSmashBlock();
            }

            newSmashBlock.WorldPosition = new Vector2((float)node.Attribute("x"), (float)node.Attribute("y"));
            newSmashBlock.SmashCallback = _smashBlockCallback;

            foreach (XElement el in node.Elements("contains-item"))
            {
                Data.SmashBlockItemData item = CreateSmashBlockItem(el, newSmashBlock.WorldPosition);
                if (item != null)
                {
                    newSmashBlock.Contents.Add(item);
                }
            }

            return newSmashBlock;
        }