Пример #1
0
    //
    /// <summary>
    /// Reads an XML that contains the spawning scenarios and places them into the database.
    /// </summary>
    private void Load_SpawnScenarios()
    {
        string textData = ((TextAsset)Resources.Load("SpawnScenarios")).text;
        //
        XmlDocument xmlDoc = new XmlDocument();

        xmlDoc.Load(new StringReader(textData));
        string      xmlPathPattern = "//SpawnScenarios/scenario";
        XmlNodeList nodeList       = xmlDoc.SelectNodes(xmlPathPattern);

        //
        everySpawnScenario = new Dictionary <string, SpawnScenario>();
        //
        SpawnScenario ssN;

        foreach (XmlNode node in nodeList)
        {
            ssN = new SpawnScenario();
            //
            ssN.name = node.FirstChild.InnerXml;
            foreach (XmlNode entry in node.SelectNodes("entry"))
            {
                XmlNode o = entry.FirstChild;
                // Debug.Log("Node is: " + o.Name + " (" + o.InnerXml + ")");
                SpawnSequence sequence = QuerySpawnSequence(o.InnerXml);
                o = o.NextSibling;
                float xx = float.Parse(o.InnerXml);
                o = o.NextSibling;
                float yy = float.Parse(o.InnerXml);
                o = o.NextSibling;
                float timing = float.Parse(o.InnerXml);
                //
                Debug.Log(timing + " timing");
                ssN.Add(new SpawnSequenceRunner(sequence, new Vector2(xx, yy)), timing);
            }
            //
            everySpawnScenario.Add(ssN.name, ssN);
        }

        foreach (SpawnScenario Q in everySpawnScenario.Values)
        {
            Debug.Log("Entry: " + Q.name);
        }
    }
Пример #2
0
 public LevelInfo(string lay, SpawnScenario stage, List <Structure.StructureTypes> inven)
 {
     layout   = lay;
     scenario = stage;
     turrets  = inven;
 }