Beispiel #1
0
 public static void Update(this TileStruct tile, Type item)
 {
     if (item.BaseType == typeof(BaseEnvironment))
     {
         tile.UpdateEnvironment(item);
     }
     else if (item.BaseType == typeof(BaseFloor))
     {
         tile.UpdateFloor(item);
     }
     else
     {
         tile.UpdateObject(item);
     }
 }
Beispiel #2
0
        private void TileClicked(object sender, RoutedEventArgs e)
        {
            if (Mouse.LeftButton == MouseButtonState.Pressed)
            {
                if (lvAllItems.SelectedItem != null)
                {
                    BuilderItemStruct item = (BuilderItemStruct)lvAllItems.SelectedItem;
                    TileStruct        tile = (TileStruct)((Label)sender).DataContext;

                    if (item.type.BaseType == typeof(BaseFloor))
                    {
                        tile.UpdateFloor(item.type);
                    }
                    else
                    {
                        tile.UpdateObject(item.type);
                    }
                }
                else
                {
                    MessageBox.Show("Kies een item");
                }
            }
            else if (Mouse.RightButton == MouseButtonState.Pressed)
            {
                TileStruct tile = (TileStruct)((Label)sender).DataContext;
                if (tile.gameObject.GetType() != Blocks.EMPTY)
                {
                    tile.UpdateObject(Blocks.EMPTY);
                }
                else if (tile.gameObject.GetType() != Floors.EMPTY_FLOOR)
                {
                    tile.UpdateFloor(Floors.EMPTY_FLOOR);
                }
            }
        }
Beispiel #3
0
 public static void Update(this TileStruct tile, Type floor, Type obj)
 {
     tile.UpdateFloor(floor);
     tile.UpdateObject(obj);
 }