コード例 #1
0
        static void Main()
        {
            Console.WriteLine("Web API Client says: \"Hello World!\"");
            EmptyMapComponent e = new EmptyMapComponent();

            e.draw(0, 0);
            PlayerDecorator pd = new PlayerDecorator(e);

            pd.draw(5, 6);

            EnemyDecorator ed = new EnemyDecorator(e);

            Console.ReadKey();
        }
コード例 #2
0
ファイル: PBTests.cs プロジェクト: PetrasBartusis/DPAndTests
        public void Test_Decorator_Map()
        {
            EmptyMapComponent e = new EmptyMapComponent();

            e.draw(0, 0);
            PlayerDecorator pd = new PlayerDecorator(e);

            pd.draw(Convert.ToInt32(p.x), Convert.ToInt32(p.y));
            Assert.AreEqual(e.currentMap[p.x][p.y], 'P');
            EnemyDecorator ed           = new EnemyDecorator(e);
            EnemyParty     enemyParties = new EnemyParty(new Coordinates(3, 3));

            ed.draw(Convert.ToInt32(enemyParties.position.x), Convert.ToInt32(enemyParties.position.y));
            Assert.AreEqual(e.currentMap[Convert.ToInt32(enemyParties.position.x)][Convert.ToInt32(enemyParties.position.y)], 'E');
        }