예제 #1
0
        public void Build_wall_count_dora()
        {
            Wall wall = new Wall();

            wall.Build(RuleSets.DefaultRules);
            Assert.AreEqual(1, wall.Doras.Count);
        }
예제 #2
0
        public void Build_wall_count_hidden_dead()
        {
            Wall wall = new Wall();

            wall.Build(RuleSets.DefaultRules);
            Assert.AreEqual(13, wall.NumberOfHiddenDeadTiles);
        }
예제 #3
0
        public void Build_wall_count_drawable()
        {
            Wall wall = new Wall();

            wall.Build(RuleSets.DefaultRules);
            Assert.AreEqual(122, wall.NumberDrawsRemaining);
        }
예제 #4
0
        public void Drawing_decreases_drawable_tiles_by_one()
        {
            Wall wall = new Wall();

            wall.Build(RuleSets.DefaultRules);
            int prev = wall.NumberDrawsRemaining;

            wall.Draw();
            Assert.AreEqual(prev - 1, wall.NumberDrawsRemaining);
        }
예제 #5
0
        public void Cannot_draw_more_than_drawable()
        {
            Wall wall = new Wall();

            wall.Build(RuleSets.DefaultRules);
            int draws = wall.NumberDrawsRemaining;

            for (int i = 0; i < draws; i++)
            {
                wall.Draw();
            }
            Tile next = wall.Draw();

            Assert.AreEqual(Tile.Invalid, next);
        }
예제 #6
0
    private void TowerBuildUIClickedHandler(object sender, EventArgs args)
    {
        if (sender is TowerBuildUI)
        {
            if (_selection != null)
            {
                var towerBuildUI = (sender as TowerBuildUI);
                if (towerBuildUI.Prefab == null || ResourceManager.LoseMoney(towerBuildUI.Prefab.Cost))
                {
                    _selection.Build(towerBuildUI.Prefab);
                }
            }

            this.Cancel();
        }
    }
예제 #7
0
        public void Output_wall_to_file()
        {
            Wall wall = new Wall();

            wall.Build(RuleSets.DefaultRules);
            StreamWriter fout = new StreamWriter("output.txt");

            fout.WriteLine("New Wall:");
            fout.WriteLine("Dora: " + wall.Doras[0].ToString());
            fout.WriteLine("Wall tiles, in order: ");
            Tile tile;
            int  i = 1;

            while (wall.NumberDrawsRemaining > 0)
            {
                tile = wall.Draw();
                fout.WriteLine("    " + i + ": " + tile.ToString());
                i++;
            }
            fout.Close();
        }
예제 #8
0
        public void Run()
        {
            Console.Title         = "Bouncing Ball";
            Console.CursorVisible = false;
            Console.SetWindowSize(90, 30);
            Console.BufferHeight = 30;
            Console.BufferWidth  = 90;
            int height = Console.BufferHeight;
            int width  = Console.BufferWidth;
            var border = new Border(width, height);

            border.CreateBorder();
            var wall = new Wall(47, 12, width, height);
            var ball = new Ball(45, 15, wall, width, height);

            var moveThread = new Thread(new ThreadStart(ball.Bounce));

            moveThread.IsBackground = true;
            moveThread.Start();

            wall.Build();
        }