예제 #1
0
            internal SlopeFillerVoxel(SlopeEntity entity, int x, int y, int z, int idx)
                : base(entity, x, y, z)
            {
                int glevel = WorldDefinition.World.GetGroundLevel(Location);

                drawSurfaceBelow = !(idx < 2 && glevel >= z);
                drawSurfaceAbove = !(idx >= 2 && glevel >= z + 1);
            }
예제 #2
0
        /// <summary>
        /// Creates a new slope. A slope consists of four consective
        /// blocks of railroads. The base parameter specifies the location
        /// of the lowest railroad and the direction parameter
        /// specifies the direction to climb.
        ///
        /// The caller must use the canCreateSlope method to check
        /// if this method can be invoked.
        /// </summary>
        public static void createSlope(Location _base, Direction dir)
        {
            Debug.Assert(canCreateSlope(_base, dir));

            // charge the cost before we alter something
            Accounting.AccountGenre.RailService.Spend(calcCostOfNewSlope(_base, dir));

            SlopeEntity entity = new SlopeEntity(_base, dir);

            for (int i = 0; i < 4; i++)
            {
                if (_base.z < WorldDefinition.World.GetGroundLevel(_base))
                {
                    new SlopeRailRoad(entity, TrafficVoxel.getOrCreate(
                                          _base.x, _base.y, _base.z + (i / 2)),
                                      RailPattern.getUGSlope(dir, i));
                    if (i < 2)
                    {
                        // space filler
                        new SlopeFillerVoxel(entity, _base.x, _base.y, _base.z + 1, i);
                    }
                    else
                    {
                        new SlopeSupportVoxel(entity, _base.x, _base.y, _base.z, i,
                                              RailPattern.slopeWalls[dir.index + i - 2]);
                    }
                }
                else
                {
                    new SlopeRailRoad(entity, TrafficVoxel.getOrCreate(
                                          _base.x, _base.y, _base.z + (i / 2)),
                                      RailPattern.getSlope(dir, i));
                    if (i < 2)
                    {
                        // space filler
                        new SlopeFillerVoxel(entity, _base.x, _base.y, _base.z + 1, i);
                    }
                    else
                    {
                        new SlopeSupportVoxel(entity, _base.x, _base.y, _base.z, i,
                                              RailPattern.slopeSupports[dir.index + (i - 2)]);
                    }
                }

                Type bridgeStyle;
                if (dir == Direction.NORTH || dir == Direction.EAST)
                {
                    bridgeStyle = typeof(BridgePierVoxel.DefaultImpl);
                }
                else
                {
                    bridgeStyle = typeof(BridgePierVoxel.SlopeNEImpl);
                }
                BridgePierVoxel.electBridgeSupport(_base, bridgeStyle, entity);

                _base += dir;
            }
        }
예제 #3
0
            internal SlopeSupportVoxel(SlopeEntity entity, int x, int y, int z, int idx, ISprite s)
                : base(entity, x, y, z)
            {
                int glevel = WorldDefinition.World.GetGroundLevel(Location);

                drawSurfaceBelow = !(idx < 2 && glevel >= z);
                drawSurfaceAbove = !(idx >= 2 && glevel >= z + 1);
                sprite           = s;
            }
예제 #4
0
 private SlopeRailRoad(SlopeEntity e, TrafficVoxel v, RailPattern rp)
     : base(v, rp)
 {
     entity = e;
 }