public void ReplaceTerrain(int X, int Y, Terrain TerrainPreset, int LayerIndex)
            {
                TerrainConquest NewTerrain = new TerrainConquest(TerrainPreset);

                NewTerrain.Position = new Vector3(X, Y, 0);

                ActiveMap.ListLayer[LayerIndex].ArrayTerrain[X, Y] = NewTerrain;
            }
            public void EditTerrain(int X, int Y, int LayerIndex)
            {
                TerrainConquest SelectedTerrain = ActiveMap.GetTerrain(X, Y, LayerIndex);
                TileAttributes  TA = new TileAttributes(new TerrainConquest(SelectedTerrain));

                if (TA.ShowDialog() == DialogResult.OK)
                {
                    ReplaceTerrain(X, Y, new TerrainConquest(X, Y, SelectedTerrain.TerrainTypeIndex), LayerIndex);
                }
            }
            public void ResizeTerrain(int NewWidth, int NewHeight, Terrain TerrainPreset, DrawableTile TilePreset)
            {
                for (int L = 0; L < GetLayerCount(); ++L)
                {
                    //Init the MapTiles.
                    TerrainConquest[,] ArrayTerrain = new TerrainConquest[NewWidth, NewHeight];
                    DrawableTile[,] ArrayTile2D     = new DrawableTile[NewWidth, NewHeight];
                    for (int X = 0; X < NewWidth; X++)
                    {
                        for (int Y = 0; Y < NewHeight; Y++)
                        {
                            if (X < ActiveMap.MapSize.X && Y < ActiveMap.MapSize.Y)
                            {
                                ArrayTerrain[X, Y] = ActiveMap.ListLayer[L].ArrayTerrain[X, Y];
                                ArrayTile2D[X, Y]  = ((Map2D)ActiveMap.ListLayer[L].LayerGrid).GetTile(X, Y);
                            }
                            else
                            {
                                if (ActiveMap.ListTilesetPreset.Count > 0)
                                {
                                    TerrainConquest NewTerrain = new TerrainConquest(TerrainPreset);
                                    DrawableTile    NewTile    = new DrawableTile(TilePreset);
                                    NewTerrain.Position = new Vector3(X, Y, 0);

                                    ArrayTerrain[X, Y] = NewTerrain;
                                    ArrayTile2D[X, Y]  = NewTile;
                                }
                                else
                                {
                                    ArrayTerrain[X, Y] = new TerrainConquest(X, Y);
                                    ArrayTile2D[X, Y]  = ((Map2D)ActiveMap.ListLayer[L].LayerGrid).GetTile(X, Y);
                                }
                            }
                        }
                    }

                    ActiveMap.ListLayer[L].ArrayTerrain = ArrayTerrain;
                    ((Map2D)ActiveMap.ListLayer[L].LayerGrid).ReplaceGrid(ArrayTile2D);
                }

                ActiveMap.MapSize = new Point(NewWidth, NewHeight);
            }
Esempio n. 4
0
        public TileAttributes(TerrainConquest ActiveTerrain)
        {
            InitializeComponent();

            cboTerrainType.SelectedIndex = ActiveTerrain.TerrainTypeIndex;
        }
 public void Init(Terrain ActiveTerrain, Terrain.TilesetPreset ActivePreset)
 {
     ActiveTerrain = this.ActiveTerrain = new TerrainConquest(ActiveTerrain);
     cboTerrainType.SelectedIndex = ActiveTerrain.TerrainTypeIndex;
 }