コード例 #1
0
        private Collectable CreateCollectableFromXmlNode(XElement node, Vector2 worldPosition)
        {
            Collectable newCollectable = null;

            switch (node.Name.ToString())
            {
            case GoldenTicket.Data_Node_Name:
                if (!Data.Profile.CurrentAreaData.GoldenTicketHasBeenCollectedFromLevel(worldPosition))
                {
                    newCollectable = new GoldenTicket();
                }
                break;

            case ScoringCandy.Data_Node_Name:
                newCollectable = new ScoringCandy();
                ((ScoringCandy)newCollectable).ScoreValue = (int)node.Attribute("score");
                _candyCount++;
                break;
            }

            if (newCollectable != null)
            {
                newCollectable.ID = string.Concat(Serialized_Data_Identifier, _nextCollectableID++);
                newCollectable.SetTextureAndRelatedValues(node.Attribute("texture").Value);
            }

            return(newCollectable);
        }
コード例 #2
0
        private Collectable CreateCollectableFromXmlNode(XElement node, Vector2 worldPosition)
        {
            Collectable newCollectable = null;

            switch (node.Name.ToString())
            {
                case GoldenTicket.Data_Node_Name:
                    if (!Data.Profile.CurrentAreaData.GoldenTicketHasBeenCollectedFromLevel(worldPosition)) { newCollectable = new GoldenTicket(); }
                    break;
                case ScoringCandy.Data_Node_Name:
                    newCollectable = new ScoringCandy();
                    ((ScoringCandy)newCollectable).ScoreValue = (int)node.Attribute("score");
                    _candyCount++;
                    break;
            }

            if (newCollectable != null)
            {
                newCollectable.ID = string.Concat(Serialized_Data_Identifier, _nextCollectableID++);
                newCollectable.SetTextureAndRelatedValues(node.Attribute("texture").Value);
            }

            return newCollectable;
        }