private void WindowKeyDown(object sender, KeyEventArgs e)
        {
            var foxDraw = new FoxDraw(canvas);

            if (e.Key == Key.Left)
            {
                Hero.HeroLeft(foxDraw);
            }
            if (e.Key == Key.Right)
            {
                Hero.HeroRight(foxDraw);
            }
            if (e.Key == Key.Up)
            {
                Hero.HeroUp(foxDraw);
            }
            if (e.Key == Key.Down)
            {
                Hero.HeroDown(foxDraw);
            }
        }
예제 #2
0
        private void WindowKeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Left)
            {
                hero.HeroLeft(myfoxDraw);
            }

            if (e.Key == Key.Right)
            {
                hero.HeroRight(myfoxDraw);
            }
            if (e.Key == Key.Up)
            {
                hero.HeroUp(myfoxDraw);
            }

            if (e.Key == Key.Down)
            {
                hero.HeroDown(myfoxDraw);
            }

            Counter++;
        }