Beispiel #1
0
        private void ChangeObstacleType()
        {
            ObstacleType = (ObstacleStubType)(((int)ObstacleType + 1) % 6);
            if (GDOwner.CanInsertObstacleStub(Position, ObstacleType, Width, Height, Rotation, this) == null)
            {
                Width    = GDConstants.TILE_WIDTH / 2f;
                Height   = GDConstants.TILE_WIDTH / 2f;
                Rotation = 0;
            }

            GDOwner.GDHUD.AttrPanel.Recreate(this);
        }
Beispiel #2
0
        private void ChangeRot()
        {
            var idxCurr = ROTS.IndexOf(Rotation);

            for (int i = 1; i < ROTS.Length; i++)
            {
                var idxTest = (idxCurr + i) % ROTS.Length;
                if (GDOwner.CanInsertObstacleStub(Position, ObstacleType, Width, Height, ROTS[idxTest], this) != null)
                {
                    Rotation = ROTS[idxTest];
                    return;
                }
            }
        }
Beispiel #3
0
        private void ChangeDiameter()
        {
            var newsize = ((FloatMath.Round(Width / (GDConstants.TILE_WIDTH / 2f))) % 16 + 1) * (GDConstants.TILE_WIDTH / 2f);

            if (GDOwner.CanInsertObstacleStub(Position, ObstacleType, newsize, newsize, Rotation, this) != null)
            {
                Width = Height = newsize;
                return;
            }
            else
            {
                Width = Height = (GDConstants.TILE_WIDTH / 2f);
                return;
            }
        }
Beispiel #4
0
        private void ChangeHeight()
        {
            var newheight = FloatMath.Round(Height / (GDConstants.TILE_WIDTH / 2f)) * (GDConstants.TILE_WIDTH / 2f);

            newheight += (GDConstants.TILE_WIDTH / 2f);

            if (newheight > GDOwner.LevelData.Height * GDConstants.TILE_WIDTH + 4 * GDConstants.TILE_WIDTH)
            {
                newheight = (GDConstants.TILE_WIDTH / 2f);
            }

            if (GDOwner.CanInsertObstacleStub(Position, ObstacleType, Width, newheight, Rotation, this) == null)
            {
                newheight = (GDConstants.TILE_WIDTH / 2f);
            }

            Height = newheight;
        }
Beispiel #5
0
        private void ChangeWidth()
        {
            var newwidth = FloatMath.Round(Width / (GDConstants.TILE_WIDTH / 2f)) * (GDConstants.TILE_WIDTH / 2f);

            newwidth += (GDConstants.TILE_WIDTH / 2f);

            if (newwidth > GDOwner.LevelData.Width * GDConstants.TILE_WIDTH + 4 * GDConstants.TILE_WIDTH)
            {
                newwidth = (GDConstants.TILE_WIDTH / 2f);
            }

            if (GDOwner.CanInsertObstacleStub(Position, ObstacleType, newwidth, Height, Rotation, this) == null)
            {
                newwidth = (GDConstants.TILE_WIDTH / 2f);
            }

            Width = newwidth;
        }