コード例 #1
0
        public static CompoundMapBridge Get_RR_Bridge()
        {
            var bridge = new CompoundMapBridge
            {
                Name    = "Round Room",
                Terrain = new List <string>
                {
                    "..###..",
                    ".##.##.",
                    ".#...+.",
                    ".##.##.",
                    "..###..",
                },
                Width  = 7,
                Height = 5,
            };

            var trig = new Trigger
            {
                Categories = TriggerCategories.PlayerLocation,
                Condition  = "(0 0) to (99 99)",
            };

            trig.Script.Add("message");
            trig.Script.Add("I want a round room");
            trig.Script.Add("at the end of the day");
            trig.Script.Add("end message");
            trig.Script.Add("remove trigger");
            bridge.Triggers.Add(trig);

            bridge.Legend["."] = "soil";
            bridge.Legend["#"] = "stone wall";
            bridge.Legend["+"] = "closed door";

            return(bridge);
        }
コード例 #2
0
        protected void Assert_Bridges_equiv(CompoundMapBridge result, CompoundMapBridge expected)
        {
            Assert.That(result.Name, Is.EqualTo(expected.Name));
            Assert.That(result.Width, Is.EqualTo(expected.Width));
            Assert.That(result.Height, Is.EqualTo(expected.Height));

            // Checking values, not keys, since the legend keys may change
            foreach (var val in expected.Legend.Values)
            {
                Assert.That(result.Legend.ContainsValue(val), $"Legend value [{val}] missing");
            }
            Assert.That(result.Legend.Count, Is.EqualTo(expected.Legend.Count));

            for (int row = 0; row < expected.Terrain.Count; row++)
            {
                Assert.That(result.Terrain[row], Is.EqualTo(expected.Terrain[row]), $"Terrain row {row} didn't match");
            }
            Assert.That(result.Terrain.Count, Is.EqualTo(expected.Terrain.Count));

            for (int i = 0; i < expected.Triggers.Count; i++)
            {
                Assert_Trigger_equiv(result.Triggers[i], expected.Triggers[i]);
            }
        }
コード例 #3
0
 protected void Assert_Bridge_isRoundRoom(CompoundMapBridge bridge)
 {
     Assert_Bridges_equiv(bridge, Ser_Test_Data.Get_RR_Bridge());
 }