Example #1
0
        public Terrain(World world, MPos position, TerrainType type)
        {
            this.world = world;
            Position   = position;
            Type       = type;

            renderable = new StaticBatchRenderable(Position.ToCPos(), VAngle.Zero, type.Texture);
            if (type.Overlay != null)
            {
                overlay = new BatchSequence(type.Overlay, startRandom: true);
                overlay.SetPosition(Position.ToCPos());
            }
            edges   = new StaticBatchRenderable[4];
            corners = new StaticBatchRenderable[4];
        }
Example #2
0
        void updateRenderables()
        {
            for (int i = 0; i < 4; i++)
            {
                if (!edgesVisible[i])
                {
                    edges[i] = null;
                    continue;
                }

                if (edges[i] != null)
                {
                    continue;
                }

                if (i % 2 != 0 && Type.VerticalEdgeTexture != null)
                {
                    edges[i] = new StaticBatchRenderable(calculateEdgeOffset(i, false), new VAngle(0, 0, i * -90), Type.VerticalEdgeTexture);
                }
                else
                {
                    edges[i] = new StaticBatchRenderable(calculateEdgeOffset(i, true), new VAngle(0, 0, i * -90), Type.EdgeTexture);
                }
            }

            for (int i = 0; i < 4; i++)
            {
                if (!cornersVisible[i])
                {
                    corners[i] = null;
                    continue;
                }

                if (corners[i] != null)
                {
                    continue;
                }

                corners[i] = new StaticBatchRenderable(calculateCornerOffset(i), new VAngle(0, 0, i * -90), Type.CornerTexture);
            }
        }