Esempio n. 1
0
 public void HandleInput(AbstractFigure hero, Key input)
 {
     if (input == Key.Q)
     {
         hero.ChangeState(new IdleState());
     }
 }
Esempio n. 2
0
        public void Update(AbstractFigure hero)
        {
            ICommand command = null;

            switch (input)
            {
            case Key.Left:
                command = new MoveCommand(hero, new Vector(-20, 0));
                break;

            case Key.Up:
                command = new MoveCommand(hero, new Vector(0, -20));
                break;

            case Key.Right:
                command = new MoveCommand(hero, new Vector(20, 0));
                break;

            case Key.Down:
                command = new MoveCommand(hero, new Vector(0, 20));
                break;
            }

            if (command != null)
            {
                command.Execute();
            }
        }
Esempio n. 3
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            var createWindow = new CreateWindow();

            if (createWindow.ShowDialog() == true)
            {
                var factory = new FigureFactory();

                for (int i = 0; i < createWindow.Count; i++)
                {
                    AbstractFigure figure = null;

                    if (createWindow.Type == FigureType.Circle)
                    {
                        figure = factory.CreateCircle();
                    }
                    else if (createWindow.Type == FigureType.Rectangle)
                    {
                        figure = factory.CreateRectangle();
                    }

                    map.Add(figure);
                }

                UpdateFigures();
            }
        }
Esempio n. 4
0
 public void HandleInput(AbstractFigure hero, Key input)
 {
     if (input == Key.Up ||
         input == Key.Down ||
         input == Key.Left ||
         input == Key.Right)
     {
         hero.ChangeState(new MovementState(input));
     }
     else if (input == Key.Q)
     {
         hero.ChangeState(new ChangeColorState());
     }
 }
Esempio n. 5
0
        public void Update(AbstractFigure hero)
        {
            var command = new ChangeColorCommand(hero);

            command.Execute();
        }
Esempio n. 6
0
 public MoveCommand(AbstractFigure hero, Vector vector)
 {
     this.hero   = hero;
     this.vector = vector;
 }
Esempio n. 7
0
 public void Add(AbstractFigure part)
 {
     parts.Add(part);
 }
Esempio n. 8
0
 public void Update(AbstractFigure hero)
 {
 }