internal SlopeFillerVoxel(SlopeEntity entity, int x, int y, int z, int idx) : base(entity, x, y, z) { int glevel = World.world.getGroundLevel(location); drawSurfaceBelow = !(idx < 2 && glevel >= z); drawSurfaceAbove = !(idx >= 2 && glevel >= z + 1); }
/// <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.RAIL_SERVICE.spend(calcCostOfNewSlope(_base, dir)); SlopeEntity entity = new SlopeEntity(_base, dir); for (int i = 0; i < 4; i++) { if (_base.z < World.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; } }
internal SlopeSupportVoxel(SlopeEntity entity, int x, int y, int z, int idx, Sprite s) : base(entity, x, y, z) { int glevel = World.world.getGroundLevel(location); drawSurfaceBelow = !(idx < 2 && glevel >= z); drawSurfaceAbove = !(idx >= 2 && glevel >= z + 1); sprite = s; }
private SlopeRailRoad(SlopeEntity e, TrafficVoxel v, RailPattern rp) : base(v, rp) { entity = e; }