Exemplo n.º 1
0
        public object Clone()
        {
            ContentSolutionShape ss = new ContentSolutionShape();

//            ss.AssetName = AssetName;
            ss.IsFlippedHorizontal = IsFlippedHorizontal;
            ss.IsFlippedVertical   = IsFlippedVertical;
            ss.OriginPoint         = OriginPoint;
            ss.RotationIdx         = RotationIdx;
            ss.ShapeKey            = ShapeKey;
            return(ss);
        }
Exemplo n.º 2
0
        public void DrawForHint(SpriteBatch spriteBatch, Vector2 offset, ContentSolutionShape css, float pAlpha)
        {
            SpriteEffects spriteEffect  = SpriteEffects.None;
            float         rotationDelta = 0;
            float         rot           = ROTATIONS[css.RotationIdx];
            Vector2       position      = new Vector2(css.OriginPoint.X * TileSize.X, css.OriginPoint.Y * TileSize.Y);
            Vector2       origin        = baseOrigin;

            if (css.IsFlippedHorizontal && css.IsFlippedVertical)
            {
                // rotate shape 180 degrees
                rotationDelta = MathHelper.ToRadians(180);
                spriteEffect  = SpriteEffects.None;
            }
            else if (css.IsFlippedHorizontal)
            {
                spriteEffect = SpriteEffects.FlipHorizontally;
            }
            else if (css.IsFlippedVertical)
            {
                spriteEffect = SpriteEffects.FlipVertically;
            }

            // adjust position on odd rotation idx shapes
            if (baseMatrixDimensions.X != baseMatrixDimensions.Y)
            {
                if (css.RotationIdx % 2 != 0)
                {
                    if (baseMatrixDimensions.X > baseMatrixDimensions.Y)
                    {
                        position = adjustRenderPosition(position, baseMatrixDimensions.X);
                    }
                    else
                    {
                        position = adjustRenderPosition(position, baseMatrixDimensions.Y);
                    }
                }
            }

            spriteBatch.Draw(textureHL,
                             (position + origin + offset),
                             null,
                             new Color(1, 1, 1, pAlpha),
                             rot + rotationDelta,
                             origin,
                             1,
                             spriteEffect,
                             0f);
        }