public AnimationBackground3D(ContentManager Content, GraphicsDevice g)
            : this("", Content, g)
        {
            ListBackground = new List <AnimationBackground3DBase>();

            MoveSpeed          = Vector3.Zero;
            IndexedLinesEffect = new BasicEffect(g);

            int GridWidth = 5;
            int GridDepth = 5;

            VertexPositionColor[] ArrayBackgroundGridVertex = new VertexPositionColor[GridWidth * 8];
            // Initialize an array of indices of type short.
            short[] ArrayBackgroundGridIndices = new short[(ArrayBackgroundGridVertex.Length * 2) - 2];

            int LineLength = 100;
            int Index      = 0;

            for (int X = -GridWidth; X < GridWidth; ++X)
            {
                ArrayBackgroundGridVertex[Index * 2] = new VertexPositionColor(
                    new Vector3(X * LineLength, 0, -LineLength * GridDepth - LineLength / 2), Color.White);
                ArrayBackgroundGridVertex[Index * 2 + 1] = new VertexPositionColor(
                    new Vector3(X * LineLength, 0, LineLength * GridDepth - LineLength / 2), Color.White);

                ArrayBackgroundGridIndices[Index * 2]     = (short)(Index * 2);
                ArrayBackgroundGridIndices[Index * 2 + 1] = (short)(Index * 2 + 1);

                ++Index;
            }
            for (int Z = -GridWidth; Z < GridWidth; ++Z)
            {
                ArrayBackgroundGridVertex[Index * 2] = new VertexPositionColor(
                    new Vector3(-LineLength * GridWidth - LineLength / 2, 0, Z * LineLength), Color.White);
                ArrayBackgroundGridVertex[Index * 2 + 1] = new VertexPositionColor(
                    new Vector3(LineLength * GridWidth - LineLength / 2, 0, Z * LineLength), Color.White);

                ArrayBackgroundGridIndices[Index * 2]     = (short)(Index * 2);
                ArrayBackgroundGridIndices[Index * 2 + 1] = (short)(Index * 2 + 1);

                ++Index;
            }

            BackgroundGrid = new IndexedLines(ArrayBackgroundGridVertex, ArrayBackgroundGridIndices);

            InitBounds();
        }
        private void InitBounds()
        {
            VertexPositionColor[] ArrayBoundsVertex = new VertexPositionColor[8];
            ArrayBoundsVertex[0] = new VertexPositionColor(new Vector3(-WorldWidth, 0, WorldDepth), Color.White);
            ArrayBoundsVertex[1] = new VertexPositionColor(new Vector3(WorldWidth, 0, WorldDepth), Color.White);
            ArrayBoundsVertex[2] = new VertexPositionColor(new Vector3(WorldWidth, 0, -WorldDepth), Color.White);
            ArrayBoundsVertex[3] = new VertexPositionColor(new Vector3(-WorldWidth, 0, -WorldDepth), Color.White);

            ArrayBoundsVertex[4] = new VertexPositionColor(new Vector3(-WorldWidth, Ceiling, WorldDepth), Color.White);
            ArrayBoundsVertex[5] = new VertexPositionColor(new Vector3(WorldWidth, Ceiling, WorldDepth), Color.White);
            ArrayBoundsVertex[6] = new VertexPositionColor(new Vector3(WorldWidth, Ceiling, -WorldDepth), Color.White);
            ArrayBoundsVertex[7] = new VertexPositionColor(new Vector3(-WorldWidth, Ceiling, -WorldDepth), Color.White);

            short[] ArrayBoundsIndices = new short[24];

            ArrayBoundsIndices[0] = 0;
            ArrayBoundsIndices[1] = 1;
            ArrayBoundsIndices[2] = 1;
            ArrayBoundsIndices[3] = 2;
            ArrayBoundsIndices[4] = 2;
            ArrayBoundsIndices[5] = 3;
            ArrayBoundsIndices[6] = 3;
            ArrayBoundsIndices[7] = 0;

            ArrayBoundsIndices[8]  = 4;
            ArrayBoundsIndices[9]  = 5;
            ArrayBoundsIndices[10] = 5;
            ArrayBoundsIndices[11] = 6;
            ArrayBoundsIndices[12] = 6;
            ArrayBoundsIndices[13] = 7;
            ArrayBoundsIndices[14] = 7;
            ArrayBoundsIndices[15] = 4;

            ArrayBoundsIndices[16] = 0;
            ArrayBoundsIndices[17] = 4;
            ArrayBoundsIndices[18] = 1;
            ArrayBoundsIndices[19] = 5;
            ArrayBoundsIndices[20] = 2;
            ArrayBoundsIndices[21] = 6;
            ArrayBoundsIndices[22] = 3;
            ArrayBoundsIndices[23] = 7;

            Bounds = new IndexedLines(ArrayBoundsVertex, ArrayBoundsIndices);
        }