Exemplo n.º 1
0
    public void LoadMap(LevelData levelData)
    {
        destroyContent();
        this.MapName = levelData.name;
        LoadMap();
        LevelMetaData metadata = gameObject.AddComponent(typeof(LevelMetaData)) as LevelMetaData;

        MDParser.Parse(levelData.name, ref metadata);
        metadata.LoadMetaData();
        GetComponent <EnemySpawner>().SpawnEnemies(levelData.name, model.Height, model.Width);
        model.levelInfo = levelData;
        DisplayOverlays();
    }
Exemplo n.º 2
0
        public void MDParser_ParseMarkdown_Parse1paragraph()
        {
            string[] text = new string[]
            {
                "",
                "# Header",
                "",
                "Paragraph text",
                ""
            };

            CollectionAssert.AreEqual(new string[] { "Paragraph text" }, MDParser.ParseMarkdown(text).Text.ToArray());
        }
Exemplo n.º 3
0
        public void MDParser_ParseParagraph_ComplexTest()
        {
            string[] text = new string[]
            {
                "# Header 1",
                "",
                "## Header 1.1",
                "",
                "Text 1.1",
                "",
                "## Header 1.2"
            };

            int iLine = 0;

            MDParagraph paragraph = MDParser.ParseParagraph(text, ref iLine, 1);

            Assert.AreEqual("Header 1", paragraph.Header);
            Assert.AreEqual(0, paragraph.Text.Count);
            Assert.AreEqual(1, paragraph.Level);
            Assert.AreEqual(2, paragraph.SubParagraphs.Count);

            MDParagraph p11 = paragraph.SubParagraphs[0];

            Assert.AreEqual("Header 1.1", p11.Header);
            Assert.AreEqual(1, p11.Text.Count);
            Assert.AreEqual("Text 1.1", p11.Text[0]);
            Assert.AreEqual(2, p11.Level);
            Assert.AreEqual(0, p11.SubParagraphs.Count);

            MDParagraph p12 = paragraph.SubParagraphs[1];

            Assert.AreEqual("Header 1.2", p12.Header);
            Assert.AreEqual(0, p12.Text.Count);
            Assert.AreEqual(2, p12.Level);
            Assert.AreEqual(0, p12.SubParagraphs.Count);
        }
Exemplo n.º 4
0
 public void MDParser_ParseMarkdown_ParseHeader()
 {
     Assert.AreEqual("Header 1", MDParser.ParseMarkdown(new string[] { "# Header 1 #" }).Header);
 }
Exemplo n.º 5
0
 public void MDParser_ParseMarkdown_NotFirstHeader()
 {
     Assert.Catch <FormatException>(() =>
                                    MDParser.ParseMarkdown(new string[] { "## Header" })
                                    );
 }
Exemplo n.º 6
0
 public void MDParser_ParseMarkdown_TextWoHeader()
 {
     Assert.Catch <FormatException>(() =>
                                    MDParser.ParseMarkdown(new string[] { "No header" })
                                    );
 }