Ejemplo n.º 1
0
        // For each node, create a new node with attributes
        public void RecursiveBuild(XmlNode xmlNode, Node parent)
        {
            int             id        = int.Parse(xmlNode.Attributes.GetNamedItem("id").Value);
            int             depth     = int.Parse(xmlNode.Attributes.GetNamedItem("depth").Value);
            int             health    = int.Parse(xmlNode.Attributes.GetNamedItem("health").Value);
            int             X         = int.Parse(xmlNode.Attributes.GetNamedItem("X").Value);
            int             Y         = int.Parse(xmlNode.Attributes.GetNamedItem("Y").Value);
            string          type      = xmlNode.Attributes.GetNamedItem("type").Value;
            StationNodeType typeValue = 0;

            switch (type)
            {
            case "Core": typeValue = StationNodeType.Core; break;

            case "Pipe": typeValue = StationNodeType.Pipe; break;

            case "Turret": typeValue = StationNodeType.Turret; break;
            }

            Node node = new Node(depth, parent);

            node.position = new Vector2(X, Y);
            node.data     = new StationNode(node, typeValue, health);
            node.id       = id;

            parent.Add(node);

            foreach (XmlNode child in xmlNode.ChildNodes)
            {
                RecursiveBuild(child, node);
            }
        }
Ejemplo n.º 2
0
        public StationNode(Node node, Station station)
        {
            this.node    = node;
            this.station = station;
            this.texture = ContentStore.station_core;
            this.color   = Color.White;
            bounds       = new Rectangle(100000, 100000, 28, 28);

            if (node.depth == 0)
            {
                nodeType = StationNodeType.Core;
            }
            else if (node.depth == station.max_depth || node.depth % station.split_depth == 0)
            {
                nodeType = StationNodeType.Turret;
            }
            else
            {
                nodeType = StationNodeType.Pipe;
            }

            health = 100;

            Initialise();
        }
Ejemplo n.º 3
0
        public StationNode(Node node, StationNodeType type, int health)
        {
            this.node     = node;
            this.texture  = ContentStore.station_core;
            this.color    = Color.White;
            this.nodeType = type;
            this.health   = health;

            Initialise();
        }