Пример #1
0
 private void RemoveObjectFromTile(TileStruct tile)
 {
     if (tile.gameObject.GetType() != Blocks.EMPTY)
     {
         tile.Update(Blocks.EMPTY);
     }
     else if (tile.environmentObject.GetType() != Blocks.EMPTY)
     {
         tile.UpdateEnvironment(Blocks.EMPTY);
     }
     else if (tile.gameObject.GetType() != Floors.EMPTY_FLOOR)
     {
         tile.Update(Floors.EMPTY_FLOOR);
     }
 }
Пример #2
0
        private void TileClicked(object sender, RoutedEventArgs e)
        {
            if (Mouse.LeftButton == MouseButtonState.Pressed)
            {
                if (ActiveListView != null && ActiveListView.SelectedItem != null)
                {
                    BuilderItemStruct item = (BuilderItemStruct)ActiveListView.SelectedItem;
                    TileStruct        tile = (TileStruct)((Label)sender).DataContext;
                    tile.Update(item.type);

                    if (Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift))
                    {
                        FillArea(levelEditor.grid.FindTilePosition(tile), item.type);
                    }

                    if (Keyboard.IsKeyDown(Key.LeftAlt) || Keyboard.IsKeyDown(Key.RightAlt))
                    {
                        FillAreaSquared(levelEditor.grid.FindTilePosition(tile), item.type);
                    }
                }
                else
                {
                    MessageBox.Show("Kies een item");
                }
            }
            else if (Mouse.RightButton == MouseButtonState.Pressed)
            {
                TileStruct tile = (TileStruct)((Label)sender).DataContext;
                RemoveObjectFromTile(tile);
            }
        }