コード例 #1
0
        private void CreateItemsForSingleTexture(Data.SmashBlockItemData itemData, Vector2 WorldPosition, Vector2 CameraPosition)
        {
            if (_registerObject != null)
            {
                for (int i = 0; i < itemData.Count; i++)
                {
                    SmashBlockItem newItem = null;

                    foreach (string s in Glowing_Item_Texture_Prefixes.Split(','))
                    {
                        if (itemData.TextureName.StartsWith(s))
                        {
                            newItem = new SmashBlockGlowingItem(); break;
                        }
                    }
                    if (newItem == null)
                    {
                        newItem = new SmashBlockItem();
                    }

                    newItem.TimerTickCallback = _registerTimerTick;
                    newItem.Texture           = TextureManager.Textures[itemData.TextureName];
                    newItem.Frame             = TextureManager.Textures[itemData.TextureName].Bounds;
                    newItem.WorldPosition     = WorldPosition;
                    newItem.CameraPosition    = CameraPosition;

                    _registerObject(newItem);
                }
            }
        }
コード例 #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);
        }
コード例 #3
0
        private Data.SmashBlockItemData CreateSmashBlockItem(XElement node, Vector2 smashBlockWorldPosition)
        {
            if ((node.Attribute("action").Value == "add-ticket") && (Data.Profile.CurrentAreaData.GoldenTicketHasBeenCollectedFromCrate(smashBlockWorldPosition)))
            {
                return(null);
            }

            Data.SmashBlockItemData itemData = new Data.SmashBlockItemData();
            itemData.TextureName = node.Attribute("texture").Value;
            itemData.Count       = (int)node.Attribute("units");

            switch (node.Attribute("action").Value)
            {
            case "add-ticket": itemData.AffectsItem = Data.SmashBlockItemData.AffectedItem.GoldenTicket; break;

            case "score": itemData.AffectsItem = Data.SmashBlockItemData.AffectedItem.Score; _smashBlockCandyCount += itemData.Count; break;
            }

            itemData.Value = (int)node.Attribute("value");

            return(itemData);
        }
コード例 #4
0
        private Data.SmashBlockItemData CreateSmashBlockItem(XElement node, Vector2 smashBlockWorldPosition)
        {
            if ((node.Attribute("action").Value == "add-ticket") && (Data.Profile.CurrentAreaData.GoldenTicketHasBeenCollectedFromCrate(smashBlockWorldPosition)))
            {
                return null;
            }

            Data.SmashBlockItemData itemData = new Data.SmashBlockItemData();
            itemData.TextureName = node.Attribute("texture").Value;
            itemData.Count = (int)node.Attribute("units");

            switch (node.Attribute("action").Value)
            {
                case "add-ticket": itemData.AffectsItem = Data.SmashBlockItemData.AffectedItem.GoldenTicket; break;
                case "score": itemData.AffectsItem = Data.SmashBlockItemData.AffectedItem.Score; _smashBlockCandyCount += itemData.Count; break;
            }

            itemData.Value = (int)node.Attribute("value");

            return itemData;
        }