예제 #1
0
        public void FillCellIndex(int x, int y, int DesiredIndex)
        {
            int oldIndex = currentLayer.GetCellIndex(x, y);

            if (oldIndex == DesiredIndex || fillCounter == 0)
            {
                return;
            }

            fillCounter--;
            currentLayer.SetCellIndex(x, y, DesiredIndex);

            if (x > 0 && currentLayer.GetCellIndex(x - 1, y) == oldIndex)
            {
                FillCellIndex(x - 1, y, DesiredIndex);
            }
            if (x < currentLayer.LayerWidthinTiles - 1 && currentLayer.GetCellIndex(x + 1, y) == oldIndex)
            {
                FillCellIndex(x + 1, y, DesiredIndex);
            }
            if (y > 0 && currentLayer.GetCellIndex(x, y - 1) == oldIndex)
            {
                FillCellIndex(x, y - 1, DesiredIndex);
            }
            if (y < currentLayer.LayerHeightinTiles - 1 && currentLayer.GetCellIndex(x, y + 1) == oldIndex)
            {
                FillCellIndex(x, y + 1, DesiredIndex);
            }
        }
        public void FillCell(int x, int y, int desiredIndex)
        {
            int oldIndex = currentLayer.GetCellIndex(x, y);

            if (desiredIndex == oldIndex || FillCounter == 0)
            {
                return;
            }

            FillCounter--;

            currentLayer.SetCellIndex(x, y, desiredIndex);

            if (x > 0 && currentLayer.GetCellIndex(x - 1, y) == oldIndex)
            {
                FillCell(x - 1, y, desiredIndex);
            }
            if (x < currentLayer.Width - 1 && currentLayer.GetCellIndex(x + 1, y) == oldIndex)
            {
                FillCell(x + 1, y, desiredIndex);
            }
            if (y > 0 && currentLayer.GetCellIndex(x, y - 1) == oldIndex)
            {
                FillCell(x, y - 1, desiredIndex);
            }
            if (y < currentLayer.Height - 1 && currentLayer.GetCellIndex(x, y + 1) == oldIndex)
            {
                FillCell(x, y + 1, desiredIndex);
            }
        }
        public override void Excute()
        {
            TileLayer currentLayer = this.form.currentLayer;

            if ((this.form.TileX != null) || (this.form.TileY != null))
            {
                int TileX = (int)this.form.TileX;
                int TileY = (int)this.form.TileY;

                this.TileLocation    = new Vector2(TileX, TileY);
                this.layer           = currentLayer;
                this.PreviousTexture = currentLayer.GetCellIndex(TileX, TileY);

                int IndexToSet = -1;
                currentLayer.SetCellIndex(TileX, TileY, IndexToSet);
            }
        }
        public override void Excute()
        {
            TileLayer currentLayer = this.form.currentLayer;

            if (form.TextureList.Items.Count > 0 && form.TextureList.SelectedItem != null)
            {
                if ((this.form.TileX != null) || (this.form.TileY != null))
                {
                    int TileX = (int)this.form.TileX;
                    int TileY = (int)this.form.TileY;

                    this.TileLocation    = new Vector2(TileX, TileY);
                    this.layer           = currentLayer;
                    this.PreviousTexture = currentLayer.GetCellIndex(TileX, TileY);

                    string TextureToSet = form.TextureList.SelectedItem.ToString();

                    Texture2D text       = form.dictTextures[TextureToSet];
                    int       IndexToSet = currentLayer.HasTexture(text);
                    currentLayer.SetCellIndex(TileX, TileY, IndexToSet);
                }
            }
        }