void CommandDropDown_SelectionChanged(object sender, RoutedEventArgs e)
        {
            UserControl panel;
            int         tick = Math.Max(0, GameState.Get().Tick - entity.SpawningCycles[0]);

            switch ((string)CommandDropDown.SelectedItem)
            {
            case "AccelerateTo":
                command = new MovementPolarAccelerateTo(tick);
                panel   = new MovementPolarAccelerateToPanel(command);
                break;

            case "Turn":
                command = new MovementPolarTurn(tick);
                panel   = new MovementPolarTurnPanel(command);
                break;

            default:
                return;
            }

            ((IMovementPanel)panel).SetInternalEntityDefinition(entity);
            entity.MovementSystem.AddMovementCommand(tick, command);

            Grid.SetRow(panel, 1);
            Grid.SetColumn(panel, 0);
            Grid.SetColumnSpan(panel, 2);
            BodyGrid.Children.Add(panel);
        }
        public MovementPolarAccelerateToPanel(MovementQuanta command)
        {
            InitializeComponent();

            this.command = (MovementPolarAccelerateTo)command;

            // Populate entries
            TickBox.Text     = this.command.StartingTick.ToString();
            DurationBox.Text = this.command.Duration.ToString();
            EndSpeed.Text    = this.command.EndingSpeed.ToString();

            TickBox.TextChanged     += UpdateCommand;
            DurationBox.TextChanged += UpdateCommand;
            EndSpeed.TextChanged    += UpdateCommand;
        }
Ejemplo n.º 3
0
 static private IMovementPanel CreateMovementPanel(MovementQuanta command)
 {
     if (command is MovementPolarAccelerateTo)
     {
         return(new MovementPolarAccelerateToPanel(command));
     }
     else if (command is MovementPolarTurn)
     {
         return(new MovementPolarTurnPanel(command));
     }
     else
     {
         return(null);
     }
 }
Ejemplo n.º 4
0
        public MovementPolarTurnPanel(MovementQuanta command)
        {
            InitializeComponent();

            this.command = (MovementPolarTurn)command;

            // Populate entries
            TickBox.Text     = this.command.StartingTick.ToString();
            DurationBox.Text = this.command.Duration.ToString();
            TotalBox.Text    = this.command.Total.ToString();

            TickBox.TextChanged     += UpdateCommand;
            DurationBox.TextChanged += UpdateCommand;
            TotalBox.TextChanged    += UpdateCommand;
        }