Ejemplo n.º 1
0
        private void DrawGame(Game game)
        {
            //first clear whole canvas
            GameCanvas.Children.Clear();
            //then add each point to canvas
            foreach (var dot in game.GetAllSnakeDots())
            {
                //Genereate rectangle and add it to canvas
                GameCanvas.Children.Add(CreateSnakerectangle(dot.ActualPosition));
            }
            //draw an apple
            foreach (var apple in game.GetApplesDots())
            {
                GameCanvas.Children.Add(CreateApple(apple.Position));
            }

            RoundProgress.Maximum = Settings.Default.NoRounds;
            RoundProgress.Value   = game.GameRounds;
        }