diff --git a/Assets/BigShipTycoon/Editor/EconomyVerification.cs b/Assets/BigShipTycoon/Editor/EconomyVerification.cs index 8e0a473..faa324a 100644 --- a/Assets/BigShipTycoon/Editor/EconomyVerification.cs +++ b/Assets/BigShipTycoon/Editor/EconomyVerification.cs @@ -15,6 +15,7 @@ namespace BigShipTycoon.Editor VerifySunDeckRefit(); VerifyPlacedSunDeckFittings(); VerifyFlagshipCampaign(); + VerifyMegaLiner(); VerifyLiveCrossingSettlement(); VerifyConcurrentSettlement(); VerifyStormAndShipSystems(); @@ -22,7 +23,77 @@ namespace BigShipTycoon.Editor VerifyPortOrders(); VerifyMultiStopItinerary(); VerifyShoreExcursions(); - Debug.Log("Big Ship Tycoon economy verification passed for both starts, pricing, fuel, venue and sun deck refits, fleet settlements, saves, weather, ship systems, crew payroll, laundry, port orders, multi-stop itineraries and shore excursions."); + Debug.Log("Big Ship Tycoon economy verification passed for both starts, pricing, fuel, venue and sun deck refits, MEGA commissions and facilities, fleet settlements, saves, weather, ship systems, crew payroll, laundry, port orders, multi-stop itineraries and shore excursions."); + } + + private static void VerifyMegaLiner() + { + HullSpec hull = Market.Hulls[Market.Mega]; + Company company = Company.Start(false); + company.Cash = 9_000_000; + company.Voyages = hull.Voyages; + company.Reputation = hull.Reputation; + int available = company.AvailableCash; + Require(company.Acquire(Market.Mega, false, "Horizon Crown") != null && company.AvailableCash == available, + "a liner commission needs the completed flagship charter even with the required voyage count, reputation, and cash"); + company.Flagship = true; + company.Voyages--; + Require(company.ShipyardBlock(Market.Mega, false) != null, "the liner checks completed voyages after the charter"); + company.Voyages++; + company.Reputation--; + Require(company.ShipyardBlock(Market.Mega, false) != null, "the liner also checks reputation after the charter"); + company.Reputation++; + Require(company.ShipyardBlock(Market.Mega, true) != null, "the liner can only be commissioned new"); + + Require(company.Acquire(Market.Ocean, false, "North Star") == null, "prepare an Ocean Class hull for the exclusive fitting checks"); + Ship ocean = company.ActiveShip; + Require(company.Build(ocean, 0, 0, Facility.SkyResidence) != null && company.Build(ocean, 0, 0, Facility.ProductionGalley) != null, + "Ocean Class cannot fit either a MEGA guest venue or utility"); + int beforeCommission = company.Cash; + Require(company.Acquire(Market.Mega, false, "Horizon Crown") == null && company.Cash == beforeCommission - hull.Price, + "unlocked liner commission charges the advertised price once"); + Ship ship = company.ActiveShip; + Require(ship.Decks.Count == 12 && hull.MaxDecks == 15 && hull.Length >= 300 && hull.Beam >= 48 + && ship.Decks[0].Cells.Length == 64 && ship.DailyPayroll > ocean.DailyPayroll && ship.Tank > ocean.Tank, + "the liner is longer, wider and taller with an appropriately larger tank and crew complement"); + Require(company.AddDeck(ship) == null && company.AddDeck(ship) == null && company.AddDeck(ship) == null + && ship.Decks.Count == 15 && company.AddDeck(ship) != null, "the liner expands to its own deck limit"); + + int tank = ship.Tank, galley = ship.GalleyCapacity, stores = ship.FoodCapacity; + int water = ship.WaterCapacity, waterOutput = ship.WaterProduction, waste = ship.WasteCapacity, wasteOutput = ship.WasteTreatment; + var fittings = new[] { Facility.SkyResidence, Facility.MarketHall, Facility.OceanArena, Facility.BunkerFarm, Facility.PanoramaClub, + Facility.ThermalSpa, Facility.ProductionGalley, Facility.ColdChain, Facility.MembranePlant, Facility.ReclamationPlant, + Facility.EngineeringCenter, Facility.Galleria, Facility.RoyalCasino, Facility.LaundryPlant }; + for (int i = 0; i < fittings.Length; i++) + Require(company.Build(ship, i / 2, i % 2 * 6, fittings[i]) == null, $"fit {fittings[i]} on the liner"); + Require(ship.Beds == 128 && ship.Meals == 840 && ship.Entertainment == 720 && ship.BarCapacity == 340 + && ship.PoolCapacity == 480 && ship.RetailCapacity == 590 && ship.CasinoCapacity == 640, + "each new guest facility adds its own service capacity"); + Require(ship.Tank == tank + 320 && ship.GalleyCapacity == galley + 360 && ship.FoodCapacity == stores + 5400 + && ship.WaterCapacity == water + 60000 && ship.WaterProduction == waterOutput + 36000 + && ship.WasteCapacity == waste + 44000 && ship.WasteTreatment == wasteOutput + 40000, + "the enlarged utilities add fuel, provisions, cooking, water, and treatment headroom"); + + int afterFit = company.Cash; + Require(company.Build(ship, 0, 0, Facility.SkyResidence, 1) == null && company.Cash == afterFit + && ship.Decks[0].FacilityAt(3 * hull.Columns + 1, hull.Columns) == Facility.SkyResidence, + "turn the residence through four rows without paying for it again"); + Require(company.Refuel(ship, ship.Tank) == null && company.Build(ship, 1, 6, Facility.Empty) != null, + "a full bunker farm cannot be removed while the remaining tanks would overflow"); + + ship.Fare = 600; + ship.Condition = 94; + Voyage quote = company.Forecast(ship, 1); + var voyage = new OnboardSession(ship, quote); + voyage.ServiceMachinery(); + Require(quote.Guests > 0 && quote.SuiteGuests == quote.Guests && quote.SuitePremium == quote.Guests * 840 + && quote.Crew == ship.DailyPayroll * quote.Days && voyage.RepairCredit == 7 && voyage.LaundryCapacity > 558, + "a liner quote and live session use residence fares, crew payroll, laundry and engineering capacity"); + Require(company.Sail(ship, 1, voyage) == null && ship.Port == 1, "settle a liner voyage through the ordinary ledger"); + Company restored = JsonUtility.FromJson(JsonUtility.ToJson(company)); + Require(restored.CanLoad() && restored.ActiveShip.HullIndex == Market.Mega && restored.ActiveShip.Decks.Count == 15 + && restored.ActiveShip.Decks[0].RotationAt(0) == 1 && restored.ActiveShip.CasinoCapacity == 640 + && restored.History[0].SuitePremium == quote.SuitePremium, "liner fittings, rotation and voyage accounts survive save and reload"); } private static void VerifySunDeckRefit() diff --git a/Assets/BigShipTycoon/Editor/TycoonBuild.cs b/Assets/BigShipTycoon/Editor/TycoonBuild.cs index b224e11..c427de5 100644 --- a/Assets/BigShipTycoon/Editor/TycoonBuild.cs +++ b/Assets/BigShipTycoon/Editor/TycoonBuild.cs @@ -24,7 +24,7 @@ namespace BigShipTycoon.Editor EditorBuildSettings.scenes = new[] { new EditorBuildSettingsScene(ScenePath, true) }; PlayerSettings.companyName = "Big Ship Tycoon"; PlayerSettings.productName = "Big Ship Tycoon"; - PlayerSettings.bundleVersion = "0.13.0"; + PlayerSettings.bundleVersion = "0.14.0"; PlayerSettings.defaultScreenWidth = 1920; PlayerSettings.defaultScreenHeight = 1080; PlayerSettings.fullScreenMode = FullScreenMode.FullScreenWindow; diff --git a/Assets/BigShipTycoon/Resources/BridgeGlazing.shader b/Assets/BigShipTycoon/Resources/BridgeGlazing.shader index 7fb5392..c1f30a4 100644 --- a/Assets/BigShipTycoon/Resources/BridgeGlazing.shader +++ b/Assets/BigShipTycoon/Resources/BridgeGlazing.shader @@ -14,13 +14,15 @@ Shader "BigShipTycoon/Bridge Glazing" Pass { CGPROGRAM + #pragma target 3.0 #pragma vertex vert #pragma fragment frag #include "UnityCG.cginc" + #include "TycoonTexturing.cginc" fixed4 _Color; struct Input { float4 vertex : POSITION; float3 normal : NORMAL; }; - struct Output { float4 clip : SV_POSITION; float3 world : TEXCOORD0; float3 normal : TEXCOORD1; }; + struct Output { float4 clip : SV_POSITION; float3 world : TEXCOORD0; float3 normal : TEXCOORD1; float3 local : TEXCOORD2; }; Output vert(Input input) { @@ -28,6 +30,7 @@ Shader "BigShipTycoon/Bridge Glazing" output.clip = UnityObjectToClipPos(input.vertex); output.world = mul(unity_ObjectToWorld, input.vertex).xyz; output.normal = UnityObjectToWorldNormal(input.normal); + output.local = input.vertex.xyz; return output; } @@ -35,10 +38,17 @@ Shader "BigShipTycoon/Bridge Glazing" { float3 eye = normalize(_WorldSpaceCameraPos.xyz - input.world); float3 normal = normalize(input.normal); - float edge = pow(1 - abs(dot(eye, normal)), 2); - float reflection = pow(saturate(reflect(-eye, normal).y), 4); - float3 tint = lerp(_Color.rgb * .64, float3(.89,.82,.66), reflection * .36); - return fixed4(tint, .041 + edge * .21 + reflection * .058); + float edge = 1 - abs(dot(eye, normal)); + float3 reflection = reflect(-eye, normal); + float reflectedSky = smoothstep(.03, .79, reflection.y); + float horizon = 1 - smoothstep(.024, .21, abs(reflection.y - .055)); + float wash = sin(input.local.x * .51 + input.local.z * .84) * sin(input.local.y * 2.43) + * TycoonDetail(input.local.y * .386); + float glare = pow(saturate(dot(reflection, float3(-.69,.46,-.43))), 21); + float3 tint = lerp(_Color.rgb * .63, float3(.74,.83,.86), reflectedSky * .46); + tint += horizon * float3(.073,.092,.106) + glare * float3(.08,.068,.051); + float alpha = .044 + edge * edge * .20 + reflectedSky * .041 + wash * .007; + return fixed4(tint, alpha); } ENDCG } diff --git a/Assets/BigShipTycoon/Resources/HarborSurface.shader b/Assets/BigShipTycoon/Resources/HarborSurface.shader index 94a6147..2e6a576 100644 --- a/Assets/BigShipTycoon/Resources/HarborSurface.shader +++ b/Assets/BigShipTycoon/Resources/HarborSurface.shader @@ -23,6 +23,7 @@ Shader "BigShipTycoon/Harbor Surface" #pragma fragment frag #include "UnityCG.cginc" #include "OceanWaves.cginc" + #include "TycoonTexturing.cginc" fixed4 _Color; float _Roughness, _Metal, _Emissive, _Weather, _Finish, _Waterline; @@ -51,89 +52,82 @@ Shader "BigShipTycoon/Harbor Surface" return output; } - float PanelShade(float2 cell) + float SurfaceTone(float3 local, float3 localNormal) { - float3 p = frac(cell.xyx * .1031); - p += dot(p, p.yzx + 33.33); - return frac((p.x + p.y) * p.z); - } + float2 uv = TycoonPlane(local, localNormal); + float upward = abs(localNormal.y); + float weather = sin(uv.x * .91 + uv.y * 1.79) * sin(uv.y * 4.23 - uv.x * .47); + float tone = 1 + weather * _Weather * .057; - // Fade details whose period falls beneath a pixel, especially around the railings. - float Detail(float phase) - { - return 1 - smoothstep(.25, .86, fwidth(phase)); - } - - float Groove(float phase, float width) - { - float edge = abs(frac(phase + .5) - .5); - float feather = max(.002, fwidth(phase) * .56); - return (1 - smoothstep(width, width + feather, edge)) * Detail(phase); - } - - float SurfaceTone(float3 p, float3 normal) - { - float paint = sin(p.x * .82 + p.z * 1.7) * sin(p.y * 3.5 + p.z * 4.8); - float tone = 1 + paint * _Weather * .16; if (_Finish == 1) { - float horizontal = step(.6, abs(normal.y)); - float crossGrain = lerp(p.y, p.z, horizontal); - float across = crossGrain / .215; - float row = floor(across); - float along = p.x * .383 + row * .381966; - float plank = PanelShade(float2(floor(along), row)) - .5; - float fibre = crossGrain * 53 + .73 * sin(p.x * 2.8 + crossGrain * 32); - float grain = sin(fibre) * Detail(crossGrain * 8.4); - float seams = Groove(across, .014) + Groove(p.x * .383 + frac(row * .381966), .0026); - float wear = sin(p.x * 2.2 + crossGrain * 2.9) * cos(crossGrain * 8.2 - p.x * 1.9); - tone = 1 + plank * .19 * Detail(across) + grain * .055 - seams * lerp(.12, .27, horizontal) - + wear * .036 * _Weather; + float board; + float caulk = TycoonPanel(uv, float2(.406, 6.1), .376, .0025, board); + float fibre = TycoonGrain(uv, 11); + float lowGrain = sin(uv.y * 26 + sin(uv.x * 1.16) * 2.6) * TycoonDetail(uv.y * 4.15); + tone += board * .26 + fibre * .049 + lowGrain * .055 + - caulk * lerp(.17, .35, upward) + TycoonStipple(uv, 83) * .045; } else if (_Finish == 3) { - float crossFibre = abs(normal.y) > .55 ? p.z : p.y; - float weave = cos(p.x * 142) * cos(crossFibre * 153) * Detail(crossFibre * 24.4) * Detail(p.x * 22.6); - float mottling = sin(p.x * 11 + crossFibre * 16) * sin(p.x * 23 - crossFibre * 13); - tone = 1 + .037 * weave + .028 * mottling * Detail(p.x * 3.7); + float weave = TycoonWeave(uv, float2(23, 29)); + float nap = TycoonStipple(uv + float2(uv.y * .24, 0), 87) * .080; + tone += weave * .061 + nap; if (_FabricMotif > .01) { - float2 diamonds = float2(p.x + crossFibre, p.x - crossFibre) * 1.83; - float braid = Groove(diamonds.x, .065) * .046 + Groove(diamonds.y, .065) * .046; - float inset = Groove(diamonds.x + .5, .08) * Groove(diamonds.y + .5, .08) * .19; - tone += (braid + inset - .026) * _FabricMotif; + float2 diamonds = float2(uv.x + uv.y, uv.x - uv.y) * 1.83; + float border = TycoonJoint(diamonds.x, .056) + TycoonJoint(diamonds.y, .056); + float rosette = TycoonJoint(diamonds.x + .5, .13) * TycoonJoint(diamonds.y + .5, .13); + tone += (border * .084 + rosette * (.125 + .075 * weave) - .028) * _FabricMotif; } } else if (_Finish == 4) { - float brush = abs(normal.y) > .55 ? p.z : p.y; - float scratches = sin(brush * 82 + sin(p.x * 1.25)) * Detail(brush * 13); - tone = 1 + scratches * .04 + paint * .025; + float mill = uv.y * 79 + sin(uv.x * 1.25) * .20; + float satin = cos(mill * 6.283185) * TycoonDetail(uv.y * 79); + float polishing = TycoonGrain(uv, 13.2) * .034; + tone += satin * .058 + polishing + weather * .019; } - else if (_Finish == 5) + else if (_Finish == 5 || _Finish == 9) { - float along = p.x + p.z * .42; - float plateRow = floor(p.y * .86); - float plateAlong = along * .23 + plateRow * .5; - float irregular = PanelShade(float2(floor(plateAlong), plateRow)) - .5; - float runoff = sin(along * 9.1 + sin(along * 2.1)) * sin(along * 2.9 - .2 * p.y); - float plates = Groove(p.y * .86, .008) + Groove(plateAlong, .005); - float salt = 1 - smoothstep(-.04, .82, p.y); - tone = 1 + salt * .15 - + (irregular * .25 + paint * .1 + runoff * .21 * Detail(along * 1.45) - plates * .21) * _Weather; + float plate; + float strength = _Finish == 5 ? 1 : .45; + float above = 1 - smoothstep(.18, 1.74, local.y); + float joints = TycoonPanel(uv, float2(.193, .844), .5, .008, plate); + float runoff = sin(uv.x * 9.1 + sin(uv.x * 2.1)) * sin(uv.x * 2.9 - .2 * uv.y); + tone += (plate * .092 - joints * .21) * strength * (1 - upward * .80) + + (.14 * above + runoff * .093 * TycoonDetail(uv.x * 1.45)) * _Weather + + TycoonStipple(uv, 67) * .035; + } + else if (_Finish == 7) + { + float vein = max(TycoonVein(uv), TycoonVein(uv * .46 + float2(.45,.17)) * .78); + float stone; + float joints = TycoonPanel(uv, float2(1.31, 1.31), .5, .0035, stone); + tone += stone * .060 - vein * .096 - joints * .17 + TycoonStipple(uv, 94) * .033; + } + else if (_Finish == 8 || _Finish == 10) + { + float grass = _Finish == 8 ? 1 : 0; + float mowing = sin(uv.y * 3.7 + .25 * sin(uv.x * .63)) * TycoonDetail(uv.y * .59); + float aggregate = TycoonStipple(uv, 53) * .28 + TycoonStipple(uv, 130) * .13; + tone += aggregate + grass * (.075 * mowing + .058 * weather); + } + else if (_Finish != 2 && _Finish != 11) + { + // Orange-peel paint remains nearly solid on rails and thin moldings. + tone += TycoonStipple(uv, 118) * (.038 + _Weather * .025); } if (_TileFrequency > 0) { - float3 axis = abs(normal); - float2 face = axis.y > .57 ? p.xz : axis.x > axis.z ? p.zy : p.xy; - float2 grout = face * _TileFrequency; - float tileVariation = (PanelShade(floor(grout)) - .5) * Detail(grout.x) * Detail(grout.y); - tone *= 1 + tileVariation * .18 - max(Groove(grout.x, .036), Groove(grout.y, .036)) * .31; + float ceramic; + float grout = TycoonPanel(uv, float2(_TileFrequency, _TileFrequency), 0, min(.009, .044 / _TileFrequency), ceramic); + tone *= 1 + ceramic * .23 - grout * .37; } return tone; } - float3 PoolColor(float3 world, float4 basin, float3 normal, float3 eye, float3 sky, float glint, float fresnel) + float3 PoolColor(float4 basin, float3 normal, float3 eye, float3 sky, float glint, float fresnel) { // Unmapped water is used for small fountains. Pool caps carry distance to their own basin edges. if (basin.z < .01) @@ -141,14 +135,17 @@ Shader "BigShipTycoon/Harbor Surface" float edge = min(basin.z - abs(basin.x), basin.w - abs(basin.y)); float shallow = 1 - smoothstep(.015, .86, edge); float bottomShade = lerp(.73, 1, smoothstep(-.01, .14, edge)); - float2 p = world.xz; + float2 p = basin.xy; float time = _Time.y; float2 wave = float2(p.x * 2.29 + p.y * 1.88, p.y * 2.63 - p.x * 1.03); wave.x += .17 * sin(p.y * 6.3 - time * 1.7) + time * .22; wave.y += .13 * sin(p.x * 5.04 + time * 1.52) - time * .31; float distance = min(abs(frac(wave.x) - .5), abs(frac(wave.y) - .5)); float feather = max(max(fwidth(wave.x), fwidth(wave.y)) * .69, .029); - float caustic = (1 - smoothstep(.021, .027 + feather, distance)) * Detail(wave.x) * Detail(wave.y); + float caustic = (1 - smoothstep(.021, .027 + feather, distance)) * TycoonDetail(wave.x) * TycoonDetail(wave.y); + float tile; + float grout = TycoonPanel(p, float2(12.5, 12.5), 0, .0035, tile); + bottomShade *= 1 + tile * .05 - .11 * grout; float3 body = _Color.rgb * lerp(float3(.52,.68,.83), float3(1.14,1.39,1.37), shallow); float3 teal = body * bottomShade + caustic * float3(.07,.15,.13) * lerp(.45, 1, shallow); float waterFresnel = .06 + pow(1 - saturate(dot(eye, normal)), 5) * .54; @@ -160,11 +157,11 @@ Shader "BigShipTycoon/Harbor Surface" float3 normal = normalize(input.normal); if (_Finish == 6) { - float2 p = input.world.xz; + float2 p = input.local.xz; float rippleX = p.x * 5.7 + p.y * 2.2 - _Time.y * 2.7; float rippleZ = p.y * 8.3 - p.x * 1.3 + _Time.y * 3.1; - float3 ripple = float3(sin(rippleX) * Detail(p.x * .91), 0, sin(rippleZ) * Detail(p.y * 1.32)); - normal = normalize(normal + ripple * .095); + float3 ripple = float3(sin(rippleX) * TycoonDetail(p.x * .91), 0, sin(rippleZ) * TycoonDetail(p.y * 1.32)); + normal = normalize(normal + mul((float3x3)unity_ObjectToWorld, ripple) * .095); } float3 eye = unity_OrthoParams.w > .5 ? UNITY_MATRIX_V[2].xyz : normalize(_WorldSpaceCameraPos.xyz - input.world); @@ -180,7 +177,7 @@ Shader "BigShipTycoon/Harbor Surface" float3 skyReflection = lerp(float3(.11,.19,.27), float3(.39,.48,.60), saturate(reflected.y)) + sunsetStripe * float3(.20,.12,.061); if (_Finish == 6) - return fixed4(saturate(PoolColor(input.world, input.basin, normal, eye, skyReflection, specular, fresnel)), 1); + return fixed4(saturate(PoolColor(input.basin, normal, eye, skyReflection, specular, fresnel)), 1); float overcast = _TycoonSeaWeather * _TycoonSeaSailing; float3 direct = lerp(float3(.58,.46,.34), float3(.20,.24,.28), overcast); float3 light = lerp(float3(.26,.34,.43), float3(.62,.69,.75), sky) + sunlight * direct; @@ -195,7 +192,7 @@ Shader "BigShipTycoon/Harbor Surface" diffuse *= lerp(.60, 1, smoothstep(0, .64, aboveWater)); diffuse += skyReflection * (.12 * (1 - smoothstep(.04,.67,aboveWater)) * (.26 + fresnel * .62)); } - if (_Finish == 2) + if (_Finish == 2 || _Finish == 11) { float horizon = 1 - smoothstep(.005, .067 + _Roughness * .12, abs(reflected.y - .025)); float roofReflection = smoothstep(.21, .28, reflected.y) * (1 - smoothstep(.31, .44, reflected.y)); @@ -203,11 +200,19 @@ Shader "BigShipTycoon/Harbor Surface" + float3(.18,.23,.25) * roofReflection * .12; float facing = smoothstep(-.12, .49, reflected.y); float3 glass = diffuse * (.47 + facing * .30) + glazing + specular * float3(.65,.55,.41) * .33; - return fixed4(saturate(lerp(glass, diffuse + glazing * .32 + _Color.rgb * .22, _Emissive)), 1); + if (_Finish == 11) + { + float2 uv = TycoonPlane(input.local, normalize(input.localNormal)); + float2 centers = uv * 8.5 + float2(frac(floor(uv.y * 8.5) * .5), 0); + float2 cell = frac(centers) - .5; + float coverage = (1 - smoothstep(.022, .069, dot(cell, cell))) * TycoonDetail2(uv * 8.5); + glass = lerp(glass, float3(.54,.68,.71) + glazing * .32, coverage * .58); + } + return fixed4(TycoonHighlightRollOff(lerp(glass, diffuse + glazing * .32 + _Color.rgb * .22, _Emissive)), 1); } float3 shine = skyReflection * (.045 + fresnel * .21 + _Metal * .16) * (1 - _Roughness * .56) + specular * float3(.73,.60,.43) * (.10 + .47 * _Metal) * saturate(3 * sunlight); - return fixed4(saturate(diffuse + shine + _Color.rgb * _Emissive * .53), 1); + return fixed4(TycoonHighlightRollOff(diffuse + shine + _Color.rgb * _Emissive * .53), 1); } ENDCG } diff --git a/Assets/BigShipTycoon/Resources/Passage.uss b/Assets/BigShipTycoon/Resources/Passage.uss index 5f35421..2f18600 100644 --- a/Assets/BigShipTycoon/Resources/Passage.uss +++ b/Assets/BigShipTycoon/Resources/Passage.uss @@ -166,6 +166,21 @@ .action.voyage-control-active { background-color: #d8b680; border-color: #e8c992; color: #1b302f; } .voyage-deck-stack .action.voyage-view-button { height: 26px; min-height: 26px; margin: 0 0 2px; } .voyage-deck-stack #passage-deck-all { margin-bottom: 6px; } +.voyage-deck-stack.voyage-deck-stack-mega { width: 155px; } +.voyage-deck-zone-row, .voyage-deck-grid { + flex-direction: row; + flex-wrap: wrap; + justify-content: space-between; +} +.voyage-deck-zone-row { margin-bottom: 4px; } +.voyage-deck-zone-row .action.voyage-view-button, .voyage-deck-grid .action.voyage-view-button { + width: 49%; + min-width: 0; + flex-shrink: 0; + padding: 0; + font-size: 11px; +} +.voyage-event-host.voyage-event-host-mega { right: 194px; } .action.voyage-reset { margin-left: 7px; } .voyage-rail { min-height: 70px; diff --git a/Assets/BigShipTycoon/Resources/PassengerSurface.shader b/Assets/BigShipTycoon/Resources/PassengerSurface.shader index 0e76a28..6c6cc0b 100644 --- a/Assets/BigShipTycoon/Resources/PassengerSurface.shader +++ b/Assets/BigShipTycoon/Resources/PassengerSurface.shader @@ -10,6 +10,7 @@ Shader "BigShipTycoon/Passenger Surface" #pragma vertex vert #pragma fragment frag #include "UnityCG.cginc" + #include "TycoonTexturing.cginc" struct Input { @@ -61,10 +62,14 @@ Shader "BigShipTycoon/Passenger Surface" float glint = pow(saturate(dot(normal, normalize(lightDirection + eye))), lerp(47, 12, skin * .72 + fabric * .12)); float luminousEdge = fresnel * (.023 + .013 * skin); float3 sheen = glint * lerp(float3(.112,.131,.145), float3(.102,.068,.055), skin) * (.37 + .64 * sun); - float2 stitch = input.body.xy * float2(185, 201) + input.body.z * float2(94, -117); - float2 filter = 1 - smoothstep(.24, .90, fwidth(stitch) * .159); - float weave = 1 + .032 * fabric * filter.x * filter.y * (sin(stitch.x) * cos(stitch.y)); - return fixed4(saturate(input.tint.rgb * light * weave + sheen + float3(.57,.69,.76) * luminousEdge), 1); + float2 cloth = input.body.xy + input.body.z * float2(.41, -.37); + float knit = TycoonWeave(cloth, float2(42, 51)); + float narrowStripe = cos(cloth.y * 137 + cloth.x * 21) * TycoonDetail(cloth.y * 21.8); + float fabricTone = fabric * (knit * .097 + narrowStripe * .024); + float pores = TycoonStipple(cloth, 122) * skin * .058; + float3 color = input.tint.rgb * light * (1 + fabricTone + pores) + sheen + + float3(.57,.69,.76) * luminousEdge; + return fixed4(TycoonHighlightRollOff(color), 1); } ENDCG } diff --git a/Assets/BigShipTycoon/Resources/PortScenerySurface.shader b/Assets/BigShipTycoon/Resources/PortScenerySurface.shader index 06cee52..a793953 100644 --- a/Assets/BigShipTycoon/Resources/PortScenerySurface.shader +++ b/Assets/BigShipTycoon/Resources/PortScenerySurface.shader @@ -18,6 +18,7 @@ Shader "BigShipTycoon/Port Scenery Surface" #pragma vertex vert #pragma fragment frag #include "UnityCG.cginc" + #include "TycoonTexturing.cginc" float4 _Color, _HazeColor; float _Detail, _Glow; @@ -33,20 +34,13 @@ Shader "BigShipTycoon/Port Scenery Surface" return output; } - float Lattice(float2 cell) - { - float3 p = frac(cell.xyx * .1031); - p += dot(p, p.yzx + 33.33); - return frac((p.x + p.y) * p.z); - } - float GroundNoise(float2 position) { float2 cell = floor(position); float2 blend = frac(position); blend *= blend * (3 - 2 * blend); - return lerp(lerp(Lattice(cell), Lattice(cell + float2(1,0)), blend.x), - lerp(Lattice(cell + float2(0,1)), Lattice(cell + 1), blend.x), blend.y); + return lerp(lerp(TycoonCell(cell), TycoonCell(cell + float2(1,0)), blend.x), + lerp(TycoonCell(cell + float2(0,1)), TycoonCell(cell + 1), blend.x), blend.y); } fixed4 frag(Output input, fixed side : VFACE) : SV_Target @@ -55,24 +49,36 @@ Shader "BigShipTycoon/Port Scenery Surface" float3 n = normalize(input.normal) * (side >= 0 ? 1 : -1); float3 view = normalize(_WorldSpaceCameraPos.xyz - p); float3 sun = normalize(float3(-.69,.40,-.43)); + float2 face = TycoonPlane(p, n); float2 samplePosition = p.xz + p.y * float2(.42,.76); float relief = GroundNoise(samplePosition * .22) - .5; - float fine = (GroundNoise(samplePosition * 1.35) - .5) * (1 - smoothstep(.35,.91, length(fwidth(samplePosition)))); + float fine = (GroundNoise(face * 1.25) - .5) * TycoonDetail2(face * 1.25); float coarse = GroundNoise(samplePosition * .071) - .5; float3 albedo = _Color.rgb * (1 + relief * .10 + fine * .075); if (_Detail == 1) { float stone = smoothstep(-.23,.29, .55 * relief + .24 * fine + .42 * coarse); - albedo *= .79 + .30 * stone + coarse * .19; + albedo *= .79 + .30 * stone + coarse * .19 + TycoonStipple(face, 6.8) * .13; albedo *= lerp(.72, 1, smoothstep(-.12, 1.4, p.y)); } - if (_Detail == 2) + else if (_Detail == 2) { - float tile = 1 - smoothstep(.024,.094, abs(frac((p.z + p.y * .56) * 1.9 + .5) - .5)); - albedo *= 1 + fine * .11 - tile * .10 * (1 - smoothstep(.28, .68, fwidth(p.z * 1.9))); + float tileShade; + float joint = TycoonPanel(face, float2(3.5, 5.2), .5, .016, tileShade); + albedo *= 1 + fine * .10 + tileShade * .22 - joint * .27; } - if (_Detail == 4) - albedo *= .87 + relief * .16 + fine * .12 + coarse * .13; + else if (_Detail == 4) + albedo *= .87 + relief * .16 + fine * .12 + coarse * .13 + TycoonStipple(face, 7.1) * .115; + else if (_Detail == 5) + { + float board; + float seam = TycoonPanel(face, float2(.40, 5.8), .39, .0032, board); + albedo *= 1 + board * .21 + TycoonGrain(face, 11) * .055 - seam * .27; + } + else if (_Detail == 6) + albedo *= 1 + TycoonStipple(face, 18) * .17 + TycoonStipple(face, 7.8) * .070; + else if (_Detail == 7) + albedo *= 1 + TycoonGrain(face, 33) * .105; float diffuse = saturate(dot(n, sun)); float sky = n.y * .5 + .5; @@ -87,7 +93,7 @@ Shader "BigShipTycoon/Port Scenery Surface" } float distance = length(_WorldSpaceCameraPos.xyz - p); float haze = smoothstep(120, 640, distance) * .87; - return fixed4(lerp(color, _HazeColor.rgb, haze), 1); + return fixed4(TycoonHighlightRollOff(lerp(color, _HazeColor.rgb, haze)), 1); } ENDCG } diff --git a/Assets/BigShipTycoon/Resources/ServiceSurface.shader b/Assets/BigShipTycoon/Resources/ServiceSurface.shader index 0132060..37936da 100644 --- a/Assets/BigShipTycoon/Resources/ServiceSurface.shader +++ b/Assets/BigShipTycoon/Resources/ServiceSurface.shader @@ -9,6 +9,7 @@ Shader "BigShipTycoon/Service Deck Surface" _BayLength ("Compartment length", Float) = 6 _RoomLight ("Compartment fixture offset", Float) = 4 _DeckTread ("Deck surface", Float) = 0 + _BulkheadLining ("Bulkhead panel joints", Float) = 0 } SubShader { @@ -16,12 +17,14 @@ Shader "BigShipTycoon/Service Deck Surface" Pass { CGPROGRAM + #pragma target 3.0 #pragma vertex vert #pragma fragment frag #include "UnityCG.cginc" + #include "TycoonTexturing.cginc" fixed4 _Color; - float _Roughness, _Metal, _Emissive, _BayLength, _RoomLight, _DeckTread; + float _Roughness, _Metal, _Emissive, _BayLength, _RoomLight, _DeckTread, _BulkheadLining; struct Input { float4 vertex : POSITION; float3 normal : NORMAL; }; struct Output { float4 clip : SV_POSITION; float3 local : TEXCOORD0; float3 normal : TEXCOORD1; }; @@ -58,17 +61,36 @@ Shader "BigShipTycoon/Service Deck Surface" corridor *= 1 - .62 * smoothstep(1.10, 2.25, abs(p.z)); work *= smoothstep(.35, 1.88, abs(p.z)); float fill = lerp(.72, 1, saturate(p.y * .72)); - float grain = p.x * 112 + p.y * 91; - float matte = .98 + .018 * (1 - smoothstep(.5, 2.4, fwidth(grain))) * sin(grain) * sin(p.z * 87 - p.y * 30); - float2 treadCoord = p.xz / .145; - float2 cell = abs(frac(treadCoord) - .5); - float relief = 1 - smoothstep(.30, .46, cell.x + cell.y); - float detail = 1 - smoothstep(.45, 1.3, fwidth(treadCoord.x) + fwidth(treadCoord.y)); - matte += .086 * relief * detail * _DeckTread * saturate(normal.y); + float2 gauge = TycoonPlane(p, normal); + float matte = .995 + TycoonStipple(gauge, 93) * .061; + if (_Metal > .5) + matte += TycoonGrain(gauge, 41) * .067; + if (_BulkheadLining > .5) + { + float plate; + float seam = TycoonPanel(gauge, float2(1, .55), .5, .0038, plate); + matte += plate * .085 - seam * .26; + } + if (_DeckTread > .5) + { + float up = saturate(normal.y); + float2 grain = p.xz * float2(10.8, 16.4); + float row = floor(grain.y); + float2 stamp = abs(frac(grain + float2(frac(row * .5), 0)) - .5); + float bolt = (1 - smoothstep(.28, .43, stamp.x + stamp.y * .82)) * TycoonDetail2(grain); + float deckPlate; + float joints = TycoonPanel(p.xz, float2(.52, .83), .5, .006, deckPlate); + matte += up * (bolt * .16 + deckPlate * .067 - joints * .21); + if (_DeckTread > 1.5) + { + float grids = max(TycoonJoint(p.x * 8.1, .068), TycoonJoint(p.z * 15.7, .082)); + matte = lerp(matte, .68 + grids * .42, TycoonDetail2(p.xz * 9.5) * up * .83); + } + } float3 diffuse = _Color.rgb * (float3(.34, .40, .42) * fill + corridor + work) * matte; float fresnel = pow(1 - saturate(dot(viewDirection, normal)), 3); float3 bounce = float3(.14, .20, .23) * fresnel * (.20 + _Metal * .40); - return fixed4(saturate(diffuse + bounce + _Color.rgb * _Emissive * .66), 1); + return fixed4(TycoonHighlightRollOff(diffuse + bounce + _Color.rgb * _Emissive * .66), 1); } ENDCG } diff --git a/Assets/BigShipTycoon/Resources/Shipwork.uss b/Assets/BigShipTycoon/Resources/Shipwork.uss index f8797a6..8674b66 100644 --- a/Assets/BigShipTycoon/Resources/Shipwork.uss +++ b/Assets/BigShipTycoon/Resources/Shipwork.uss @@ -143,6 +143,7 @@ .work-berth.work-room-20 { background-color: #69503b; border-color: #c19762; } .work-berth.work-room-21 { background-color: #455e4c; border-color: #92b192; } .work-berth.work-room-22 { background-color: #26586c; border-color: #72b5ca; } +.work-mega .work-berth { margin: 1px; } .work-berth.work-berth-join-left { margin-left: 0; border-left-width: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; } .work-berth.work-berth-join-right { margin-right: 0; border-right-width: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; } .work-berth.work-berth-join-top { margin-top: 0; border-top-width: 0; border-top-left-radius: 0; border-top-right-radius: 0; } @@ -298,3 +299,38 @@ .work-fit-modes .work-selected { border-color: #caad74; color: #f0d3a7; background-color: #30494b; } .work-fit-modes .work-tool-rotate { margin-left: auto; color: #f0d3a7; border-color: #917d55; } .work-tool-orientation { align-self: center; color: #b4d2cb; font-size: 11px; margin-right: 5px; } + +.work-mega .ship-work-heading { font-size: 36px; white-space: normal; } +.work-mega .work-deck-controls { width: 67%; max-width: 760px; min-width: 0; } +.work-mega .work-deck-selector { flex: 1 1 0; min-width: 0; flex-direction: column; } +.work-deck-band { flex-direction: row; } +.work-mega .work-deck-tab { + width: 12.5%; + min-width: 0; + flex-shrink: 0; + height: 30px; + min-height: 30px; + padding: 0; + font-size: 12px; +} +.work-deck-band-lower { border-top-width: 1px; border-top-color: #345b60; } +.work-mega .work-deck-add { flex-shrink: 0; margin-left: 7px; padding: 0 9px; font-size: 12px; } +.work-mega .work-berth-grid { left: 12%; right: 17%; top: 24%; bottom: 24%; } +.work-mega .work-berth-index { top: 3px; left: 4px; } +.work-mega .work-berth-name { font-size: 9px; } +.work-mega .work-berth .work-facility-icon, +.work-mega .work-span-caption .work-facility-icon { width: 18px; height: 18px; } +.work-mega .work-capacity-strip, .work-mega .work-fit-modes { flex-wrap: wrap; } +.work-mega .work-tool { padding: 3px 6px; margin: 0 2px; } +.work-mega .work-tool .work-facility-icon { margin-right: 5px; width: 22px; height: 22px; } +.work-mega .work-tool-copy { flex: 1 1 0; } +.work-mega .work-tool-name { font-size: 12px; white-space: normal; } +.work-mega .work-tool-cost { font-size: 10px; white-space: normal; } + +.work-offer.work-offer-mega { padding: 4px 8px; } +.work-offer.work-offer-mega .work-offer-name { font-size: 14px; white-space: normal; } +.yard-work-mega .ship-work-heading { font-size: 36px; white-space: normal; } +.yard-work-mega .work-purchase, +.yard-work-mega .work-contract { flex: 1 1 0; min-width: 0; } +.yard-work-mega .work-name-control { flex-shrink: 0; } +.yard-work-mega .work-contract-block { white-space: normal; } diff --git a/Assets/BigShipTycoon/Resources/SunDeck.uss b/Assets/BigShipTycoon/Resources/SunDeck.uss index c3367f0..4cc813b 100644 --- a/Assets/BigShipTycoon/Resources/SunDeck.uss +++ b/Assets/BigShipTycoon/Resources/SunDeck.uss @@ -113,3 +113,5 @@ border-color: #dd9a7e; background-color: rgba(159, 71, 56, .29); } + +.sun-terrace-diagram { left: 19%; right: 19%; background-color: #122d35; border-color: #79a8a4; border-width: 2px; border-radius: 18px; } diff --git a/Assets/BigShipTycoon/Resources/TycoonTexturing.cginc b/Assets/BigShipTycoon/Resources/TycoonTexturing.cginc new file mode 100644 index 0000000..1301be1 --- /dev/null +++ b/Assets/BigShipTycoon/Resources/TycoonTexturing.cginc @@ -0,0 +1,88 @@ +#ifndef TYCOON_TEXTURING +#define TYCOON_TEXTURING + +float TycoonCell(float2 cell) +{ + float3 p = frac(cell.xyx * .1031); + p += dot(p, p.yzx + 33.33); + return frac((p.x + p.y) * p.z); +} + +float TycoonDetail(float phase) +{ + return 1 - smoothstep(.24, .82, fwidth(phase)); +} + +float TycoonDetail2(float2 phase) +{ + float2 spread = fwidth(phase); + return 1 - smoothstep(.22, .75, max(spread.x, spread.y)); +} + +float TycoonJoint(float phase, float halfWidth) +{ + float pixel = max(.0002, fwidth(phase)); + float distance = abs(frac(phase + .5) - .5); + float core = max(0, halfWidth - pixel * .42); + float shoulder = halfWidth + pixel * .58; + float coverage = saturate((2 * halfWidth + .003) / pixel); + return (1 - smoothstep(core, shoulder, distance)) * coverage * (1 - smoothstep(.23, .77, pixel)); +} + +float2 TycoonPlane(float3 p, float3 normal) +{ + float3 axis = abs(normal); + if (axis.y >= max(axis.x, axis.z)) + return p.xz; + return axis.z >= axis.x ? p.xy : p.zy; +} + +// Offset narrow strips by row to break straight cross joints without introducing mip shimmer. +float TycoonPanel(float2 uv, float2 piecesPerMeter, float stagger, float jointWidth, out float variation) +{ + float2 cell = uv * piecesPerMeter; + float row = floor(cell.y); + float x = cell.x + frac(row * stagger); + variation = (TycoonCell(float2(floor(x), row)) - .5) * TycoonDetail2(cell); + return max(TycoonJoint(x, jointWidth * piecesPerMeter.x), TycoonJoint(cell.y, jointWidth * piecesPerMeter.y)); +} + +float TycoonWeave(float2 uv, float2 threadsPerMeter) +{ + float2 thread = uv * threadsPerMeter; + float2 fibre = cos(thread * 6.283185); + return (fibre.x * .39 + fibre.y * .37 + fibre.x * fibre.y * .24) * TycoonDetail2(thread); +} + +float TycoonGrain(float2 uv, float frequency) +{ + float ribbon = uv.y * frequency + sin(uv.x * 2.78 + uv.y * 27.1) * .14 + + sin(uv.x * .92 - uv.y * 12.7) * .15; + float main = sin(ribbon * 6.283185) * TycoonDetail(uv.y * frequency); + float fine = sin((ribbon * 2.17 - uv.x * .13) * 6.283185) * TycoonDetail(uv.y * frequency * 2.17); + return main * .71 + fine * .29; +} + +float TycoonVein(float2 uv) +{ + float phase = uv.x * .92 + uv.y * .62 + sin(uv.y * 2.39) * .28 + + sin(uv.x * 5.4 - uv.y * 2.7) * .071; + float quartz = TycoonJoint(phase, .037); + float fine = TycoonJoint(phase * 2.69 + .263 + .12 * sin(uv.y * 9), .016); + return quartz * .71 + fine * .29; +} + +float TycoonStipple(float2 uv, float grainsPerMeter) +{ + float2 grit = uv * grainsPerMeter; + return (TycoonCell(floor(grit)) - .5) * TycoonDetail2(grit); +} + +float3 TycoonHighlightRollOff(float3 color) +{ + // Preserve detail on white enamel, limestone, and polished edges before the framebuffer clips. + float3 excess = max(0, color - .79); + return saturate(min(color, .79) + excess / (1 + excess * 4.76)); +} + +#endif diff --git a/Assets/BigShipTycoon/Resources/TycoonTexturing.cginc.meta b/Assets/BigShipTycoon/Resources/TycoonTexturing.cginc.meta new file mode 100644 index 0000000..ed41691 --- /dev/null +++ b/Assets/BigShipTycoon/Resources/TycoonTexturing.cginc.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 67891790c57f48f18ccdbd5a4cbc34b9 +ShaderIncludeImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/BigShipTycoon/Runtime/Company.cs b/Assets/BigShipTycoon/Runtime/Company.cs index 21b1a2b..e553b35 100644 --- a/Assets/BigShipTycoon/Runtime/Company.cs +++ b/Assets/BigShipTycoon/Runtime/Company.cs @@ -119,23 +119,34 @@ namespace BigShipTycoon public HullSpec Hull => Market.Hulls[HullIndex]; public int Beds => FacilityCapacity(Facility.Cabin) + SuiteBerths; - public int SuiteBerths => FacilityCapacity(Facility.Suite) + FacilityCapacity(Facility.GrandSuite); + public int SuiteBerths => FacilityCapacity(Facility.Suite) + GrandSuiteBerths + SkyResidenceBerths; internal int GrandSuiteBerths => FacilityCapacity(Facility.GrandSuite); - public int Meals => (FacilityCapacity(Facility.Dining) + FacilityCapacity(Facility.Restaurant)) * 3; - public int Entertainment => FacilityCapacity(Facility.Entertainment) + FacilityCapacity(Facility.GrandTheater) + SunDeckPlan.AddedShows; + internal int SkyResidenceBerths => FacilityCapacity(Facility.SkyResidence); + public int Meals => (FacilityCapacity(Facility.Dining) + FacilityCapacity(Facility.Restaurant) + FacilityCapacity(Facility.MarketHall)) * 3; + public int Entertainment => FacilityCapacity(Facility.Entertainment) + FacilityCapacity(Facility.GrandTheater) + + FacilityCapacity(Facility.OceanArena) + OutdoorShowCapacity; public int PoolCapacity => FacilityCapacity(Facility.Amenity) + FacilityCapacity(Facility.ResortPool) - + FacilityCapacity(Facility.Spa) + FacilityCapacity(Facility.WaterPark) + SunDeckPlan.AddedAmenities; - public int BarCapacity => FacilityCapacity(Facility.Bar) + FacilityCapacity(Facility.CocktailLounge); - public int RetailCapacity => FacilityCapacity(Facility.Shop) + FacilityCapacity(Facility.ShoppingArcade); - public int CasinoCapacity => FacilityCapacity(Facility.CasinoLounge) + FacilityCapacity(Facility.Casino) + FacilityCapacity(Facility.GrandCasino); + + FacilityCapacity(Facility.Spa) + FacilityCapacity(Facility.WaterPark) + FacilityCapacity(Facility.ThermalSpa) + OutdoorAmenityCapacity; + public int BarCapacity => FacilityCapacity(Facility.Bar) + FacilityCapacity(Facility.CocktailLounge) + FacilityCapacity(Facility.PanoramaClub); + public int RetailCapacity => FacilityCapacity(Facility.Shop) + FacilityCapacity(Facility.ShoppingArcade) + FacilityCapacity(Facility.Galleria); + public int CasinoCapacity => FacilityCapacity(Facility.CasinoLounge) + FacilityCapacity(Facility.Casino) + + FacilityCapacity(Facility.GrandCasino) + FacilityCapacity(Facility.RoyalCasino); public int Capacity => Math.Min(Beds, Meals); - public int GalleyCapacity => 168 + HullIndex * 72 + FacilityCapacity(Facility.Galley); - public int FoodCapacity => 1500 + HullIndex * 640 + FacilityCapacity(Facility.Stores); - public int WaterCapacity => 16000 + HullIndex * 7600 + FacilityCapacity(Facility.Water); - public int WaterProduction => 9000 + HullIndex * 3900 + Count(Facility.Water) * 6000; - public int WasteCapacity => 12000 + HullIndex * 6800 + FacilityCapacity(Facility.Waste); - public int WasteTreatment => 5500 + HullIndex * 3400 + Count(Facility.Waste) * 7000; - public int Tank => Hull.Tank + FacilityCapacity(Facility.Tank); + public int GalleyCapacity => (HullIndex == Market.Mega ? 540 : 168 + HullIndex * 72) + + FacilityCapacity(Facility.Galley) + FacilityCapacity(Facility.ProductionGalley); + public int FoodCapacity => (HullIndex == Market.Mega ? 5600 : 1500 + HullIndex * 640) + + FacilityCapacity(Facility.Stores) + FacilityCapacity(Facility.ColdChain); + public int WaterCapacity => (HullIndex == Market.Mega ? 62000 : 16000 + HullIndex * 7600) + + FacilityCapacity(Facility.Water) + FacilityCapacity(Facility.MembranePlant); + public int WaterProduction => (HullIndex == Market.Mega ? 28000 : 9000 + HullIndex * 3900) + + Count(Facility.Water) * 6000 + Count(Facility.MembranePlant) * 36000; + public int WasteCapacity => (HullIndex == Market.Mega ? 52000 : 12000 + HullIndex * 6800) + + FacilityCapacity(Facility.Waste) + FacilityCapacity(Facility.ReclamationPlant); + public int WasteTreatment => (HullIndex == Market.Mega ? 26000 : 5500 + HullIndex * 3400) + + Count(Facility.Waste) * 7000 + Count(Facility.ReclamationPlant) * 40000; + internal int FittedRepairCapacity => FacilityCapacity(Facility.Workshop) + FacilityCapacity(Facility.EngineeringCenter); + internal int FittedLaundryCapacity => FacilityCapacity(Facility.LaundryPlant); + public int Tank => Hull.Tank + FacilityCapacity(Facility.Tank) + FacilityCapacity(Facility.BunkerFarm); public double BurnPerMile => Hull.TonsPerMile * (1 + (100 - Condition) * .003); public int SafeRange => Math.Max(0, (int)Math.Floor(Math.Min(Fuel - 6, Fuel * 100 / 112) / BurnPerMile)); @@ -280,15 +291,27 @@ namespace BigShipTycoon public string ShipyardBlock(int hullIndex, bool used) { - HullSpec hull = Market.Hulls[hullIndex]; - if (used && hullIndex == Market.Ocean) - return "Ocean Class hulls are available as new commissions."; + if ((uint)hullIndex >= (uint)Market.Hulls.Count) + return "Choose a hull at the shipyard."; + if (used && hullIndex >= Market.Ocean) + return $"{Market.Hulls[hullIndex].Name} hulls are available as new commissions."; if (Fleet.Count >= Market.MaxFleet) return "The fleet has reached its eight-ship limit."; + string unlock = ShipyardUnlock(hullIndex); + if (unlock != null) + return unlock; + if (AvailableCash < (used ? Market.UsedPrice(hullIndex) : Market.Hulls[hullIndex].Price)) + return "The company needs more cash."; + return null; + } + + internal string ShipyardUnlock(int hullIndex) + { + HullSpec hull = Market.Hulls[hullIndex]; + if (hullIndex == Market.Mega && !Flagship) + return "Complete the Ocean Class flagship charter from Bermuda to Lisbon."; if (Voyages < hull.Voyages || Reputation < hull.Reputation) return $"Requires {hull.Voyages} voyages and {hull.Reputation} reputation."; - if (AvailableCash < (used ? Market.UsedPrice(hullIndex) : hull.Price)) - return "The company needs more cash."; return null; } @@ -325,7 +348,7 @@ namespace BigShipTycoon Name = name, HullIndex = hullIndex, Condition = original ? 78 : used ? 72 : 100, - Fare = hullIndex == 0 ? 550 : hullIndex == 1 ? 850 : 1250, + Fare = hullIndex switch { Market.Coastal => 550, Market.Regional => 850, Market.Mega => 1450, _ => 1250 }, Fuel = original ? 48 : used ? 25 : 0 }; ship.FuelValue = ship.Fuel * Market.FuelPrice(0, 1); @@ -353,7 +376,7 @@ namespace BigShipTycoon return "The hull has reached its deck limit."; if (AvailableCash < price) return "The company needs more cash."; - if (ship.SunDeckPlan.CustomLayout && !new SunDeckGrid(ship, ship.Decks.Count + 1).Valid(ship.SunDeckPlan)) + if (!ship.SunDecksFitAt(ship.Decks.Count + 1)) return "Move fittings clear of the new sun deck's rails and structures before adding a deck."; Cash -= price; ship.AddEmptyDeck(); @@ -371,7 +394,7 @@ namespace BigShipTycoon int anchor = deck.AnchorAt(cell, columns); Facility previous = deck.Cells[anchor]; if (plan == Facility.Empty) - return previous == Facility.Tank && ship.Fuel > ship.Tank - Market.Facilities[(int)Facility.Tank].Capacity + return Market.BaseFacility(previous) == Facility.Tank && ship.Fuel > ship.Tank - Market.Facilities[(int)previous].Capacity ? "Burn more fuel before removing this tank." : null; FacilitySpec spec = Market.Facilities[(int)plan]; @@ -511,16 +534,19 @@ namespace BigShipTycoon double saturation = Math.Max(.66, 1 - recentSailings * .085); double entertainment = Math.Min(1, (double)ship.Entertainment / Math.Max(1, ship.Capacity)); - double marketDemand = (150 + ship.Capacity * .50) * from.MarketSize * to.Appeal * season * saturation; + double classDemand = ship.HullIndex == Market.Mega ? 230 + ship.Capacity * .68 : 150 + ship.Capacity * .50; + double marketDemand = classDemand * from.MarketSize * to.Appeal * season * saturation; double product = (.66 + Reputation * .006 + entertainment * .20) * (.8 + ship.Condition * .002); int roomDemand = Math.Max(0, (int)Math.Round(marketDemand * fareFactor * product)); int guests = Math.Min(roomDemand, ship.Capacity); int suiteBerths = ship.SuiteBerths; int suiteGuests = suiteBerths == 0 ? 0 : (int)Math.Round(guests * (double)suiteBerths / ship.Beds); - int grandSuiteGuests = suiteGuests == 0 ? 0 : (int)Math.Round(suiteGuests * (double)ship.GrandSuiteBerths / suiteBerths); + int skyGuests = suiteGuests == 0 ? 0 : (int)Math.Round(suiteGuests * (double)ship.SkyResidenceBerths / suiteBerths); + int premierGuests = suiteGuests == 0 ? 0 : (int)Math.Round(suiteGuests * (double)(ship.GrandSuiteBerths + ship.SkyResidenceBerths) / suiteBerths); int suitePremium = (int)Math.Round(ship.Fare / 100.0 * ( - (suiteGuests - grandSuiteGuests) * Market.Facilities[(int)Facility.Suite].FarePremiumPercent - + grandSuiteGuests * Market.Facilities[(int)Facility.GrandSuite].FarePremiumPercent)); + (suiteGuests - premierGuests) * Market.Facilities[(int)Facility.Suite].FarePremiumPercent + + (premierGuests - skyGuests) * Market.Facilities[(int)Facility.GrandSuite].FarePremiumPercent + + skyGuests * Market.Facilities[(int)Facility.SkyResidence].FarePremiumPercent)); double unitCost = ship.Fuel > 0 ? ship.FuelValue / ship.Fuel : Market.FuelPrice(ship.Port, Day); int[] crew = ship.CaptureCrew(); diff --git a/Assets/BigShipTycoon/Runtime/ConstructionPages.cs b/Assets/BigShipTycoon/Runtime/ConstructionPages.cs index 07d3ed5..cc35ff2 100644 --- a/Assets/BigShipTycoon/Runtime/ConstructionPages.cs +++ b/Assets/BigShipTycoon/Runtime/ConstructionPages.cs @@ -8,9 +8,10 @@ namespace BigShipTycoon public sealed partial class TycoonApp { private static readonly (int HullIndex, bool Used)[] Offers = - { (0, true), (0, false), (1, true), (1, false), (2, false) }; + { (Market.Coastal, true), (Market.Coastal, false), (Market.Regional, true), (Market.Regional, false), + (Market.Ocean, false), (Market.Mega, false) }; - private enum DeckTools { GuestFacilities, LargerVenues, LeisureAndRetail, ShipSystems, Gaming } + private enum DeckTools { GuestFacilities, LargerVenues, LeisureAndRetail, ShipSystems, Gaming, MegaVenues, MegaSystems } private DeckTools deckTools; private int toolRotation; private Action refreshDeckPlacement; @@ -23,6 +24,10 @@ namespace BigShipTycoon private static readonly Facility[] CasinoTools = { Facility.CasinoLounge, Facility.Casino, Facility.GrandCasino, Facility.Empty }; private static readonly Facility[] SystemsTools = { Facility.Galley, Facility.Stores, Facility.Water, Facility.Waste, Facility.Workshop, Facility.Empty }; + private static readonly Facility[] MegaVenueTools = { Facility.SkyResidence, Facility.MarketHall, Facility.OceanArena, + Facility.PanoramaClub, Facility.ThermalSpa, Facility.Galleria, Facility.RoyalCasino, Facility.Empty }; + private static readonly Facility[] MegaSystemTools = { Facility.ProductionGalley, Facility.ColdChain, Facility.MembranePlant, + Facility.ReclamationPlant, Facility.EngineeringCenter, Facility.BunkerFarm, Facility.LaundryPlant, Facility.Empty }; private static readonly Color DraftGrid = new Color(.37f, .62f, .65f, .19f); private static readonly Color DraftFine = new Color(.47f, .75f, .74f, .42f); @@ -42,6 +47,8 @@ namespace BigShipTycoon return; } + bool mega = ship.HasAftTerrace; + work.EnableInClassList("work-mega", mega); deckIndex = Mathf.Clamp(deckIndex, 0, ship.Decks.Count - 1); var titleBar = Add(work, "ship-work-head"); var heading = Add(titleBar, "ship-work-name"); @@ -52,6 +59,7 @@ namespace BigShipTycoon var deckControls = Add(titleBar, "work-deck-controls"); var selector = Add(deckControls, "work-deck-selector"); + VisualElement band = mega ? Add(selector, "work-deck-band") : selector; Button sunDeck = Action("Sun deck", () => { sunDeckEditing = true; @@ -59,9 +67,11 @@ namespace BigShipTycoon Render(); }, "work-deck-tab", "sun-deck-open"); sunDeck.EnableInClassList("work-selected", sunDeckEditing); - selector.Add(sunDeck); + band.Add(sunDeck); for (int i = ship.Decks.Count - 1; i >= 0; i--) { + if (mega && ship.Decks.Count - i == 8) + band = Add(selector, "work-deck-band work-deck-band-lower"); int floor = i; Button level = Action($"Deck {i + 1}", () => { @@ -71,7 +81,7 @@ namespace BigShipTycoon Render(); }, "work-deck-tab", $"deck-{i}"); level.EnableInClassList("work-selected", !sunDeckEditing && deckIndex == i); - selector.Add(level); + band.Add(level); } int deckPrice = company.DeckPrice(ship); string addLabel = ship.Decks.Count == ship.Hull.MaxDecks ? "Deck limit reached" : $"+ Deck {Money(deckPrice)}"; @@ -111,12 +121,17 @@ namespace BigShipTycoon var fittings = Add(work, "work-fittings"); var gauges = Add(fittings, "work-capacity-strip"); - if (deckTools == DeckTools.ShipSystems) + if (deckTools is DeckTools.ShipSystems or DeckTools.MegaSystems) { AddText(gauges, $"{ship.GalleyCapacity:N0} galley covers", "work-capacity"); AddText(gauges, $"{ship.FoodCapacity:N0} stored portions", "work-capacity"); AddText(gauges, $"{ship.WaterCapacity:N0} L freshwater", "work-capacity"); AddText(gauges, $"{ship.WasteCapacity:N0} L sewage buffer", "work-capacity"); + if (deckTools == DeckTools.MegaSystems) + { + AddText(gauges, $"{ship.Tank:N0} t bunker capacity", "work-capacity"); + AddText(gauges, $"{ship.FittedLaundryCapacity:N0} added laundry loads/day", "work-capacity"); + } } else { @@ -132,7 +147,7 @@ namespace BigShipTycoon else AddText(gauges, $"{ship.BarCapacity:N0} drink orders", "work-capacity"); } - else if (deckTools == DeckTools.Gaming) + else if (deckTools is DeckTools.Gaming or DeckTools.MegaVenues) AddText(gauges, $"{ship.CasinoCapacity:N0} gaming seats", "work-capacity"); else AddText(gauges, $"{ship.Tank:N0} t bunker capacity", "work-capacity"); @@ -145,6 +160,8 @@ namespace BigShipTycoon AddBuildToolTab(toolMode, "Leisure & retail", "facility-leisure", DeckTools.LeisureAndRetail, Facility.Shop); AddBuildToolTab(toolMode, "Casinos", "facility-casino", DeckTools.Gaming, Facility.CasinoLounge); AddBuildToolTab(toolMode, "Ship systems", "facility-systems", DeckTools.ShipSystems, Facility.Galley); + AddBuildToolTab(toolMode, "MEGA venues", "facility-mega-venues", DeckTools.MegaVenues, Facility.SkyResidence); + AddBuildToolTab(toolMode, "MEGA systems", "facility-mega-systems", DeckTools.MegaSystems, Facility.ProductionGalley); FacilitySpec selectedSpec = Market.Facilities[(int)tool]; if (selectedSpec.BayCount > 1) { @@ -160,6 +177,8 @@ namespace BigShipTycoon DeckTools.LeisureAndRetail => LeisureTools, DeckTools.Gaming => CasinoTools, DeckTools.ShipSystems => SystemsTools, + DeckTools.MegaVenues => MegaVenueTools, + DeckTools.MegaSystems => MegaSystemTools, _ => GuestTools }; foreach (Facility option in options) @@ -239,7 +258,7 @@ namespace BigShipTycoon Facility existing = deck.FacilityAt(cell, columns); FacilitySpec room = Market.Facilities[(int)existing]; var slot = Add(strip, "work-berth-slot"); - Button berth = Action("", () => BuildAtBerth(ship, deck, cell), "work-berth work-room-" + (int)existing, "berth-" + cell); + Button berth = Action("", () => BuildAtBerth(ship, deck, cell), "work-berth work-room-" + (int)Market.BaseFacility(existing), "berth-" + cell); berths[cell] = berth; slot.Add(berth); berth.RegisterCallback(_ => { hovered = cell; UpdatePreview(); }); @@ -357,6 +376,8 @@ namespace BigShipTycoon private static string VenueRequirement(FacilitySpec spec) { HullSpec hull = Market.Hulls[spec.MinimumHull]; + if (spec.MinimumHull == Market.Mega) + return $"Requires a {hull.Name}. Complete the flagship charter, reach {hull.Voyages} voyages and earn {hull.Reputation} reputation."; return $"Requires a {hull.Name} hull. Unlock the hull with {hull.Voyages} completed voyages and {hull.Reputation} reputation."; } @@ -463,7 +484,7 @@ namespace BigShipTycoon pen.LineTo(Point(xy[i], xy[i + 1])); } - switch (facility) + switch (facility == Facility.LaundryPlant ? facility : Market.BaseFacility(facility)) { case Facility.Cabin: case Facility.Suite: @@ -546,6 +567,11 @@ namespace BigShipTycoon case Facility.Workshop: Segment(6,19,15,10,14,7,18,5,20,7,19,10,16,11,8,21,6,19); break; + case Facility.LaundryPlant: + Segment(4,4,20,4,20,21,4,21,4,4); + Line(4,8,20,8); + Segment(8,13,9,11,15,11,17,14,16,17,10,18,8,16,8,13); + break; default: Line(6,6,18,18); Line(6,18,18,6); @@ -560,6 +586,7 @@ namespace BigShipTycoon var work = Add(workspace, "ship-work yard-work"); (int hullIndex, bool used) = Offers[yardSelection]; HullSpec hull = Market.Hulls[hullIndex]; + work.EnableInClassList("yard-work-mega", hullIndex == Market.Mega); var titleBar = Add(work, "ship-work-head"); var heading = Add(titleBar, "ship-work-name"); @@ -568,7 +595,7 @@ namespace BigShipTycoon AddText(heading, used ? "Fitted for service · 72% condition at delivery" : hull.Description, "ship-work-detail"); var stamp = Add(titleBar, "work-yard-stamp"); AddText(stamp, "DELIVERY AT MIAMI", "work-caption"); - AddText(stamp, $"{hull.StarterDecks} decks delivered · {hull.MaxDecks} max · {hull.Tank} t fuel", "work-yard-specs"); + AddText(stamp, $"{hull.Length:N0} × {hull.Beam:N0} m · {hull.StarterDecks} decks delivered · {hull.MaxDecks} max · {hull.Tank:N0} t fuel", "work-yard-specs"); var slipway = Add(work, "work-slipway"); slipway.generateVisualContent += context => DrawYardElevation(context, hullIndex, used); @@ -583,7 +610,7 @@ namespace BigShipTycoon int selection = item; var offer = Offers[item]; HullSpec candidate = Market.Hulls[offer.HullIndex]; - bool locked = company.Voyages < candidate.Voyages || company.Reputation < candidate.Reputation; + string requirement = company.ShipyardUnlock(offer.HullIndex); Button option = Action("", () => { yardSelection = selection; @@ -591,7 +618,9 @@ namespace BigShipTycoon Render(); }, "work-offer", "yard-" + item); option.EnableInClassList("work-selected", selection == yardSelection); - AddText(option, locked ? "LOCKED" : offer.Used ? "PRE-OWNED" : "NEW HULL", "work-caption"); + option.EnableInClassList("work-offer-mega", offer.HullIndex == Market.Mega); + option.tooltip = requirement ?? candidate.Description; + AddText(option, requirement != null ? "LOCKED" : offer.Used ? "PRE-OWNED" : "NEW HULL", "work-caption"); AddText(option, candidate.Name, "work-offer-name"); AddText(option, Money(offer.Used ? Market.UsedPrice(offer.HullIndex) : candidate.Price), "work-offer-price"); inventory.Add(option); @@ -706,9 +735,12 @@ namespace BigShipTycoon pen.Stroke(); pen.BeginPath(); + bool expanded = columns > Market.Hulls[Market.Ocean].Columns; + float firstBay = expanded ? .12f : .135f; + float lastBay = expanded ? .83f : .785f; for (int i = 0; i <= columns; i++) { - float station = Mathf.Lerp(.135f, .785f, i / (float)columns); + float station = Mathf.Lerp(firstBay, lastBay, i / (float)columns); pen.MoveTo(P(station, .198f)); pen.LineTo(P(station, .256f)); pen.MoveTo(P(station, .744f)); @@ -813,14 +845,16 @@ namespace BigShipTycoon int levels = Market.Hulls[hullIndex].StarterDecks; int allowedDecks = Market.Hulls[hullIndex].MaxDecks; - const float deckRise = .047f; + bool mega = hullIndex == Market.Mega; + float deckRise = mega ? .0275f : .047f; + float LeftEdge(int level) => mega ? level >= levels - 1 ? .285f : .055f + level * .0018f : .079f + level * .031f; + float RightEdge(int level) => mega ? .934f - level * .0041f : .872f - level * .04f; pen.strokeColor = new Color(DraftFine.r, DraftFine.g, DraftFine.b, .28f); pen.BeginPath(); for (int level = levels; level < allowedDecks; level++) { float y = .561f - level * deckRise; - float left = .079f + level * .031f; - float right = .872f - level * .04f; + float left = LeftEdge(level), right = RightEdge(level); for (float x = left; x < right; x += .022f) Path(x, y, Mathf.Min(x + .012f, right), y); } @@ -828,13 +862,12 @@ namespace BigShipTycoon for (int level = 0; level < levels; level++) { float bottom = .561f - level * deckRise; - float left = .079f + level * .031f; - float right = .872f - level * .04f; - pen.fillColor = new Color(.17f + .022f * level, .29f, .30f); + float left = LeftEdge(level), right = RightEdge(level); + pen.fillColor = new Color(.17f + (mega ? .010f : .022f) * level, .29f, .30f); pen.strokeColor = DraftFine; pen.lineWidth = 1.25f; pen.BeginPath(); - Path(left,bottom, left + .006f,bottom - .038f, right - .036f,bottom - .044f, right,bottom); + Path(left,bottom, left + .006f,bottom - deckRise * .81f, right - .036f,bottom - deckRise * .94f, right,bottom); pen.ClosePath(); pen.Fill(); pen.Stroke(); @@ -842,10 +875,10 @@ namespace BigShipTycoon pen.BeginPath(); if (used) for (float x = left + .022f; x < right - .04f; x += .028f) - Path(x,bottom - .022f, x + .014f,bottom - .022f); + Path(x,bottom - deckRise * .47f, x + .014f,bottom - deckRise * .47f); else for (float x = left + .025f; x < right - .04f; x += .1f) - Path(x,bottom - .019f, x + .050f,bottom - .019f); + Path(x,bottom - deckRise * .40f, x + .050f,bottom - deckRise * .40f); pen.Stroke(); } diff --git a/Assets/BigShipTycoon/Runtime/CrewMarket.cs b/Assets/BigShipTycoon/Runtime/CrewMarket.cs index 30d9c60..35617f3 100644 --- a/Assets/BigShipTycoon/Runtime/CrewMarket.cs +++ b/Assets/BigShipTycoon/Runtime/CrewMarket.cs @@ -13,13 +13,13 @@ namespace BigShipTycoon public readonly int DailyWage; private readonly int[] complement; - internal CrewRoleSpec(CrewRole role, string name, string description, int dailyWage, int coastal, int regional, int ocean) + internal CrewRoleSpec(CrewRole role, string name, string description, int dailyWage, int coastal, int regional, int ocean, int mega) { Role = role; Name = name; Description = description; DailyWage = dailyWage; - complement = new[] { coastal, regional, ocean }; + complement = new[] { coastal, regional, ocean, mega }; } internal int StarterCount(int hull) => complement[hull]; @@ -31,20 +31,20 @@ namespace BigShipTycoon public static readonly IReadOnlyList Roles = new[] { - new CrewRoleSpec(CrewRole.Bridge, "Bridge officers", "Stand navigation watches and keep crossings on schedule.", 350, 4, 6, 10), - new CrewRoleSpec(CrewRole.Engineering, "Engineering", "Keep propulsion, water and treatment systems running.", 220, 8, 14, 24), - new CrewRoleSpec(CrewRole.Galley, "Galley crew", "Cook meals and staff the galley during busy seatings.", 155, 12, 21, 36), - new CrewRoleSpec(CrewRole.Housekeeping, "Hotel services", "Turn over cabins and serve guests at bars, shops and amenities.", 130, 14, 24, 44), - new CrewRoleSpec(CrewRole.Laundry, "Laundry crew", "Wash cabin linen and towels using the ship’s freshwater supply.", 115, 5, 9, 18), - new CrewRoleSpec(CrewRole.Entertainment, "Entertainment", "Run the ship’s shows and guest programming.", 140, 4, 7, 16) + new CrewRoleSpec(CrewRole.Bridge, "Bridge officers", "Stand navigation watches and keep crossings on schedule.", 350, 4, 6, 10, 13), + new CrewRoleSpec(CrewRole.Engineering, "Engineering", "Keep propulsion, water and treatment systems running.", 220, 8, 14, 24, 36), + new CrewRoleSpec(CrewRole.Galley, "Galley crew", "Cook meals and staff the galley during busy seatings.", 155, 12, 21, 36, 65), + new CrewRoleSpec(CrewRole.Housekeeping, "Hotel services", "Turn over cabins and serve guests at bars, shops and amenities.", 130, 14, 24, 44, 84), + new CrewRoleSpec(CrewRole.Laundry, "Laundry crew", "Wash cabin linen and towels using the ship’s freshwater supply.", 115, 5, 9, 18, 36), + new CrewRoleSpec(CrewRole.Entertainment, "Entertainment", "Run the ship’s shows and guest programming.", 140, 4, 7, 16, 33) }; internal static bool IsRole(CrewRole role) => (uint)role < (uint)Roles.Count; public static int Minimum(Ship ship, CrewRole role) => role switch { - CrewRole.Bridge => 2 + ship.HullIndex, - CrewRole.Engineering => 4 + 2 * ship.HullIndex, + CrewRole.Bridge => ship.HullIndex == Market.Mega ? 9 : 2 + ship.HullIndex, + CrewRole.Engineering => ship.HullIndex == Market.Mega ? 15 : 4 + 2 * ship.HullIndex, _ => 0 }; @@ -56,10 +56,10 @@ namespace BigShipTycoon int additional = role switch { CrewRole.Bridge => (extraDecks + 1) / 2, - CrewRole.Engineering => extraDecks * 2 + ship.Count(Facility.Workshop), - CrewRole.Galley => extraDecks + ship.Count(Facility.Galley) * 2, + CrewRole.Engineering => extraDecks * 2 + ship.Count(Facility.Workshop) + ship.Count(Facility.EngineeringCenter) * 3, + CrewRole.Galley => extraDecks + ship.Count(Facility.Galley) * 2 + ship.Count(Facility.ProductionGalley) * 5, CrewRole.Housekeeping => extraDecks * 2 + ship.SuiteBerths / 60, - CrewRole.Laundry => extraDecks + ship.Beds / (100 + 75 * ship.HullIndex), + CrewRole.Laundry => extraDecks + ship.Beds / (100 + 75 * ship.HullIndex) + ship.Count(Facility.LaundryPlant) * 4, CrewRole.Entertainment => ship.Entertainment / 190, _ => 0 }; diff --git a/Assets/BigShipTycoon/Runtime/DeckAmbience.cs b/Assets/BigShipTycoon/Runtime/DeckAmbience.cs index 9863b9b..aa6bfca 100644 --- a/Assets/BigShipTycoon/Runtime/DeckAmbience.cs +++ b/Assets/BigShipTycoon/Runtime/DeckAmbience.cs @@ -133,27 +133,36 @@ namespace BigShipTycoon // The orbit point projects onto the sun deck rather than listening through the hull. if (decks == null) return focus; - VesselExterior.SunDeckLayout plan = decks.SunDeck; - listener.y = VesselExterior.DeckBase + displayedShip.Decks.Count * VesselExterior.DeckSpacing; + int deckCount = displayedShip.Decks.Count; + float roof = MegaDeckGeometry.RoofHeight(deckCount, SunDeckZone.Sky); + if (!onFoot) + listener.y = roof; float outdoors = session?.Quote.Weather == WeatherCondition.Storm ? .16f : 1f; - if (!plan.Custom && !plan.HasPool) - Heard(DeckSound.Crowd, plan.Pool.Position(new Vector3(-2.2f, listener.y, 0)), passengers * outdoors * .29f, 1.1f); - foreach (VesselExterior.SunDeckVenue venue in plan.Venues) + HearOutside(decks.SunDeck, roof); + if (displayedShip.HasAftTerrace) + HearOutside(decks.AftTerrace, roof - VesselExterior.DeckSpacing); + + void HearOutside(VesselExterior.SunDeckLayout plan, float elevation) { - Vector3 center = venue.Position(new Vector3(0, listener.y, 0)); - switch (venue.Kind) + if (!plan.Custom && !plan.HasPool) + Heard(DeckSound.Crowd, plan.Pool.Position(new Vector3(-2.2f, elevation, 0)), passengers * outdoors * .29f, 1.1f); + foreach (VesselExterior.SunDeckVenue venue in plan.Venues) { - case SunAttraction.Pool: - Heard(DeckSound.Crowd, venue.Position(new Vector3(-2.2f, listener.y, 0)), passengers * outdoors * .29f, 1.1f); - Heard(DeckSound.Pool, center, .11f + .28f * Service(OnboardService.Amenities) * outdoors, 1.0f); - break; - case SunAttraction.Theater: - Heard(DeckSound.Entertainment, venue.Position(new Vector3(venue.StageX, listener.y, 0)), - .36f * Service(OnboardService.Shows) * outdoors, 1.18f); - break; - default: - Heard(DeckSound.Crowd, center, passengers * outdoors * Service(OnboardService.Amenities) * .28f, 1.1f); - break; + Vector3 center = venue.Position(new Vector3(0, elevation, 0)); + switch (venue.Kind) + { + case SunAttraction.Pool: + Heard(DeckSound.Crowd, venue.Position(new Vector3(-2.2f, elevation, 0)), passengers * outdoors * .29f, 1.1f); + Heard(DeckSound.Pool, center, .11f + .28f * Service(OnboardService.Amenities) * outdoors, 1.0f); + break; + case SunAttraction.Theater: + Heard(DeckSound.Entertainment, venue.Position(new Vector3(venue.StageX, elevation, 0)), + .36f * Service(OnboardService.Shows) * outdoors, 1.18f); + break; + default: + Heard(DeckSound.Crowd, center, passengers * outdoors * Service(OnboardService.Amenities) * .28f, 1.1f); + break; + } } } return focus; diff --git a/Assets/BigShipTycoon/Runtime/DeckLayout.cs b/Assets/BigShipTycoon/Runtime/DeckLayout.cs index 03e7b4f..232cd32 100644 --- a/Assets/BigShipTycoon/Runtime/DeckLayout.cs +++ b/Assets/BigShipTycoon/Runtime/DeckLayout.cs @@ -92,11 +92,12 @@ namespace BigShipTycoon { Facility facility = plan.Cells[owner]; float width = (end - start) * grid.CellWidth; - float door = facility switch + float door = Market.BaseFacility(facility) switch { Facility.Empty => 2.4f, Facility.Cabin => 1.18f, Facility.Suite or Facility.GrandSuite => 1.56f, + _ when Market.Facilities[(int)facility].MinimumHull == Market.Mega => 2.64f, _ => end - start > 1 ? 2.20f : 1.48f }; RoomEntrance(layout, interior, cutaway, (grid.Edge(start) + grid.Edge(end)) * .5f, floor, @@ -146,6 +147,11 @@ namespace BigShipTycoon FitRetailArcade(structure, layout, grid, footprint, col, row, floor, rotation, seed); return; } + if (facility == Facility.Galleria) + { + FitMegaGalleria(structure, layout, grid, footprint, col, row, floor, rotation, seed); + return; + } Vector3 center = new((grid.Center(col + min.x) + grid.Center(col + max.x)) * .5f, floor + .06f, (grid.Row(row + min.y) + grid.Row(row + max.y)) * .5f); @@ -154,7 +160,9 @@ namespace BigShipTycoon if ((rotation & 1) != 0) (width, depth) = (depth, width); var room = new Venue(structure, layout, center, row == 0 ? -1 : 1, seed, rotation); - if (Market.IsCasino(facility)) + if (Market.Facilities[(int)facility].MinimumHull == Market.Mega) + FitMegaVenue(room, facility, width, depth, index == programDeck && anchor == programRoom); + else if (Market.IsCasino(facility)) FitCasino(room, facility, width, depth); else if (facility is Facility.Shop or Facility.Spa or Facility.WaterPark) FitNewVenue(room, facility, width, depth); @@ -224,11 +232,20 @@ namespace BigShipTycoon } } - private static bool IsGlazed(Facility facility) => facility is Facility.Cabin or Facility.Dining or Facility.Bar or Facility.Amenity + private static bool IsGlazed(Facility facility) => Market.BaseFacility(facility) is Facility.Cabin or Facility.Dining or Facility.Bar or Facility.Amenity or Facility.Suite or Facility.GrandSuite or Facility.Restaurant or Facility.ResortPool or Facility.CocktailLounge or Facility.Shop or Facility.ShoppingArcade or Facility.Spa or Facility.WaterPark || Market.IsCasino(facility); private static int FacilityFloor(Facility facility) => facility switch + { + Facility.SkyResidence or Facility.Galleria => Marble, + Facility.MarketHall or Facility.OceanArena => PromenadeRunner, + Facility.ThermalSpa => PoolDeck, + Facility.PanoramaClub or Facility.RoyalCasino => SuiteCarpet, + _ => BaseFacilityFloor(Market.BaseFacility(facility)) + }; + + private static int BaseFacilityFloor(Facility facility) => facility switch { Facility.Cabin => Carpet, Facility.Dining or Facility.Restaurant => Joinery, Facility.Entertainment or Facility.GrandTheater => 11, Facility.Bar or Facility.CocktailLounge => 7, @@ -238,7 +255,14 @@ namespace BigShipTycoon Facility.Amenity => PoolDeck, Facility.Galley or Facility.Workshop => BridgeFloor, _ => DeckTrim }; - private static StationKind? FacilityStation(Facility facility) => facility switch + internal static StationKind? FacilityStation(Facility facility) => facility switch + { + Facility.BunkerFarm => StationKind.Engine, + Facility.LaundryPlant => StationKind.Laundry, + _ => BaseFacilityStation(Market.BaseFacility(facility)) + }; + + private static StationKind? BaseFacilityStation(Facility facility) => facility switch { Facility.Cabin or Facility.Suite or Facility.GrandSuite => StationKind.Cabins, Facility.Dining or Facility.Restaurant => StationKind.Dining, diff --git a/Assets/BigShipTycoon/Runtime/DeckPassengers.cs b/Assets/BigShipTycoon/Runtime/DeckPassengers.cs index 15a5029..fe0dbbd 100644 --- a/Assets/BigShipTycoon/Runtime/DeckPassengers.cs +++ b/Assets/BigShipTycoon/Runtime/DeckPassengers.cs @@ -45,6 +45,7 @@ namespace BigShipTycoon private float animationTime; internal VesselExterior.SunDeckLayout SunDeck { get; } + internal VesselExterior.SunDeckLayout AftTerrace { get; } internal bool HasActiveGuest(GuestActivity activity) => !bridgeView && (activeIndex < 0 ? promenade : decks[activeIndex])?.Crowd.activeInHierarchy == true && passengerCrowd.HasActiveGuest(activity); @@ -78,9 +79,13 @@ namespace BigShipTycoon this.beam = beam; shader = surface; SunDeck = VesselExterior.SunDeck(ship); + if (ship.HasAftTerrace) + AftTerrace = VesselExterior.SunDeck(ship, SunDeckZone.AftTerrace); decks = new Layout[ship.Decks.Count]; - Facility programVenue = ship.Count(Facility.GrandTheater) > 0 ? Facility.GrandTheater + Facility programVenue = ship.Count(Facility.OceanArena) > 0 ? Facility.OceanArena + : ship.Count(Facility.GrandTheater) > 0 ? Facility.GrandTheater : ship.Count(Facility.Entertainment) > 0 ? Facility.Entertainment + : ship.Count(Facility.MarketHall) > 0 ? Facility.MarketHall : ship.Count(Facility.Restaurant) > 0 ? Facility.Restaurant : Facility.Dining; for (int index = 0; index < ship.Decks.Count; index++) { @@ -102,9 +107,8 @@ namespace BigShipTycoon if (index < 2) return (-length * .356f, length * .323f, beam * .77f); - float footprint = VesselExterior.DeckLength(length, index); - float offset = VesselExterior.DeckOffset(length, index); - return (offset - footprint * .43f, offset + footprint * .31f, VesselExterior.DeckHalfBeam(beam, index) * .83f); + var (footprint, width, offset) = MegaDeckGeometry.ForShip(ship, index, ship.Decks.Count); + return (offset - footprint * .43f, offset + footprint * .31f, width * .83f); } public Vector3 WalkOrigin(int index) @@ -115,7 +119,8 @@ namespace BigShipTycoon } private float BridgeHeight => VesselExterior.DeckBase + ship.Decks.Count * VesselExterior.DeckSpacing; - private float BridgeHalfWidth => beam * .66f; + private float BridgeHalfWidth => ship.HasAftTerrace + ? MegaDeckGeometry.ForShip(ship, ship.Decks.Count - 1, ship.Decks.Count).Beam * .58f : beam * .66f; private float BridgeAft => BridgeCenter - 4.45f; private float BridgeFore => BridgeCenter + 4.32f; @@ -219,12 +224,18 @@ namespace BigShipTycoon private Layout BuildPromenade() { var layout = new Layout("Open promenade", shipRoot); - float y = BridgeHeight + .015f; - VesselExterior.SunDeckLayout plan = SunDeck; + AddOutdoorGuests(layout, SunDeck, BridgeHeight + .015f, false); + if (ship.HasAftTerrace) + AddOutdoorGuests(layout, AftTerrace, BridgeHeight - VesselExterior.DeckSpacing + .015f, true); + return layout; + } + + private void AddOutdoorGuests(Layout layout, VesselExterior.SunDeckLayout plan, float y, bool terrace) + { float width = plan.HalfBeam; float aft = plan.Offset - plan.Length * .305f; - float fore = Mathf.Min(BridgeCenter - 6.0f, plan.Offset + plan.Length * .17f); - int walkers = 7 + ship.HullIndex * 3; + float fore = terrace ? plan.Offset + plan.Length * .31f : Mathf.Min(BridgeCenter - 6.0f, plan.Offset + plan.Length * .17f); + int walkers = terrace ? 10 : 7 + ship.HullIndex * 3; for (int side = -1; side <= 1; side += 2) { for (int i = 0; i < walkers; i++) @@ -250,7 +261,6 @@ namespace BigShipTycoon else AddSunAttractionGuests(layout, venue, y); } - return layout; } private static void AddSunPoolGuests(Layout layout, VesselExterior.SunDeckLayout plan, float y) @@ -343,9 +353,9 @@ namespace BigShipTycoon { float layerBase = baseLevel + layer * VesselExterior.DeckSpacing; float layerRoof = layerBase + VesselExterior.DeckSpacing; - float offset = VesselExterior.DeckOffset(length, layer); + var (layerLength, layerBeam, offset) = MegaDeckGeometry.ForShip(ship, layer, ship.Decks.Count); Vector2 center = new(offset, 0); - outline = Outline(VesselExterior.DeckLength(length, layer) / length, VesselExterior.DeckHalfBeam(beam, layer), offset); + outline = Outline(layerLength / length, layerBeam, offset); structure.Mesh(Ivory).Loft(outline, center, false, new Vector3(.98f, layerBase, .86f), new Vector3(.99f, layerBase + .57f, .88f)); structure.Mesh(DeckTrim).Loft(outline, center, false, new Vector3(.99f, layerBase + .57f, .88f), @@ -355,6 +365,13 @@ namespace BigShipTycoon structure.Mesh(2).Loft(outline, center, true, new Vector3(1, layerRoof, 1), new Vector3(.998f, layerRoof + .037f, .998f)); } + if (ship.HasAftTerrace) + { + var (deckLength, deckBeam, offset) = MegaDeckGeometry.ForShip(ship, index, ship.Decks.Count); + outline = Outline(deckLength / length, deckBeam, offset); + structure.Mesh(2).Loft(outline, new Vector2(offset, 0), true, new Vector3(.994f, y + .012f, .992f)); + } + for (int i = 0; i < outline.Length; i++) { Vector2 a = outline[i], b = outline[(i + 1) % outline.Length]; @@ -783,6 +800,17 @@ namespace BigShipTycoon layout.Stations.Add(new ShipStation(StationKind.Helm, new Vector3(x + .38f, y + 1.40f, 0))); BridgeConsole(geometry, walk, new Vector3(x + 1.83f, y, -stationOffset), 1.72f, 1); BridgeConsole(geometry, walk, new Vector3(x + 1.83f, y, stationOffset), 1.72f, 2); + if (ship.HasAftTerrace) + { + for (int side = -1; side <= 1; side += 2) + { + float stationZ = side * extent * .32f; + BridgeConsole(geometry, walk, new Vector3(x + 2.18f, y, stationZ), 2.48f, side > 0 ? 1 : 0); + geometry.Box(Carpet, new Vector3(x + .13f, y + .042f, stationZ), new Vector3(2f, .018f, 2.43f)); + geometry.Box(Gasket, new Vector3(x + 2.58f, y + 2.34f, stationZ), new Vector3(.10f, .34f, 2.57f)); + PlaceSign(layout.Room.transform, side < 0 ? "ROUTE MONITOR" : "ENGINE CONTROL", new Vector3(x + 2.524f, y + 2.34f, stationZ), 90, .09f); + } + } BuildHelmWheel(geometry, layout.Room.transform, new Vector3(x + .85f, y + 1.116f, 0)); for (int side = -1; side <= 1; side += 2) { @@ -954,7 +982,7 @@ namespace BigShipTycoon } } - private float BridgeCenter => VesselExterior.BridgeCenter(length, ship.Decks.Count); + private float BridgeCenter => MegaDeckGeometry.BridgeCenter(ship, ship.Decks.Count); private static void AddGuest(Layout layout, GuestActivity activity, Vector3 station, int seed, float heading, int service, float occupancy, float seatHeight = 0, EntertainmentProgram? program = null, float swimHalfLength = 0) => @@ -1001,9 +1029,11 @@ namespace BigShipTycoon 0 => Harbor.SurfaceFinish.Hull, 2 or Joinery => Harbor.SurfaceFinish.Timber, Carpet or BridgeFloor or Upholstery or SuiteCarpet or ShowVelvet or LoungeLeather or PromenadeRunner - or Linen or 11 => Harbor.SurfaceFinish.Fabric, + or Linen or CasinoFelt or 11 => Harbor.SurfaceFinish.Fabric, Alloy or Brass => Harbor.SurfaceFinish.Alloy, PoolWater => Harbor.SurfaceFinish.Pool, + Marble => Harbor.SurfaceFinish.Mineral, + Bulkhead or 1 => Harbor.SurfaceFinish.Panel, _ => Harbor.SurfaceFinish.Paint }; material.SetFloat("_Finish", (float)surfaceFinish); diff --git a/Assets/BigShipTycoon/Runtime/FleetPassageSave.cs b/Assets/BigShipTycoon/Runtime/FleetPassageSave.cs index 02bc0a5..defeba0 100644 --- a/Assets/BigShipTycoon/Runtime/FleetPassageSave.cs +++ b/Assets/BigShipTycoon/Runtime/FleetPassageSave.cs @@ -18,6 +18,7 @@ namespace BigShipTycoon internal sealed class PassageViewSnapshot { public int Deck, ServiceArea; + public int Outdoor; public bool Bridge, Exploring, BusinessOpen, MapOpen; } @@ -89,6 +90,7 @@ namespace BigShipTycoon private PassageViewSnapshot CapturePassageView() => new PassageViewSnapshot { Deck = passageDeck, ServiceArea = passageServiceArea, Bridge = passageBridge, Exploring = passageExploring, + Outdoor = passageSunZone.HasValue ? (int)passageSunZone.Value + 1 : 0, BusinessOpen = passageBusinessOpen, MapOpen = voyageMapOpen }; @@ -114,6 +116,13 @@ namespace BigShipTycoon else harbor.ShowDeck(passageDeck); } + else if (view.Outdoor is 1 or 2 && Ship.HasAftTerrace) + { + passageSunZone = (SunDeckZone)(view.Outdoor - 1); + passageExploring = view.Exploring && harbor.ExploreOutdoor(passageSunZone.Value); + if (!passageExploring) + harbor.FocusOutdoor(passageSunZone.Value); + } passageBusinessOpen = view.BusinessOpen; voyageMapOpen = view.MapOpen; diff --git a/Assets/BigShipTycoon/Runtime/FleetPassages.cs b/Assets/BigShipTycoon/Runtime/FleetPassages.cs index 40ce2ae..816646f 100644 --- a/Assets/BigShipTycoon/Runtime/FleetPassages.cs +++ b/Assets/BigShipTycoon/Runtime/FleetPassages.cs @@ -89,6 +89,7 @@ namespace BigShipTycoon { passageDeck = passageServiceArea = -1; passageBridge = passageExploring = false; + passageSunZone = null; crewManifestOpen = false; crewManifestLaundry = null; voyageMapOpen = false; diff --git a/Assets/BigShipTycoon/Runtime/Harbor.cs b/Assets/BigShipTycoon/Runtime/Harbor.cs index 0945025..a97b792 100644 --- a/Assets/BigShipTycoon/Runtime/Harbor.cs +++ b/Assets/BigShipTycoon/Runtime/Harbor.cs @@ -40,8 +40,9 @@ namespace BigShipTycoon private Vector3 freePosition; private ShipWalkSpace walkSpace; - private enum CameraMode { Orbit, DeckWalk, Bridge, Service } - internal enum SurfaceFinish { Paint, Timber, Glass, Fabric, Alloy, Hull, Pool } + private SunDeckZone outdoorZone; + private enum CameraMode { Orbit, DeckWalk, Bridge, Service, OutdoorWalk } + internal enum SurfaceFinish { Paint, Timber, Glass, Fabric, Alloy, Hull, Pool, Mineral, Turf, Panel, Aggregate, FritGlass } public RenderTexture Frame { get; private set; } internal Vector3 PassageWorldPosition => vessel != null ? vessel.position : Vector3.zero; @@ -164,6 +165,11 @@ namespace BigShipTycoon ExploreDeck(deckIndex); return; } + if (cameraMode == CameraMode.OutdoorWalk) + { + ExploreOutdoor(outdoorZone); + return; + } ResetOrbit(immediate); } @@ -230,6 +236,57 @@ namespace BigShipTycoon EnterWalk(CameraMode.DeckWalk, decks.WalkSpace(index), decks.WalkOrigin(index), 62f, 1.8f, 90f); } + internal void FocusOutdoor(SunDeckZone zone) + { + if (displayedShip == null || !displayedShip.SupportsSunDeck(zone)) + return; + ShowDeck(-1); + ResetOrbit(true); + var grid = new SunDeckGrid(displayedShip, zone: zone); + targetPitch = 62f; + targetZoom = zone == SunDeckZone.AftTerrace ? .37f : .68f; + targetOrbitOffset = BoundOrbitOffset(new Vector3(grid.Area.center.x, + MegaDeckGeometry.RoofHeight(displayedShip.Decks.Count, zone), 0) - OverviewFocus()); + } + + internal bool ExploreOutdoor(SunDeckZone zone) + { + if (!sailing || displayedShip == null || !displayedShip.SupportsSunDeck(zone)) + return false; + ShowDeck(-1); + outdoorZone = zone; + var grid = new SunDeckGrid(displayedShip, zone: zone); + Rect area = grid.Area; + bool terrace = zone == SunDeckZone.AftTerrace; + var space = new ShipWalkSpace(area.xMin, area.xMax, area.yMin - (terrace ? 1.65f : 0), area.yMax + (terrace ? 1.65f : 0)); + if (!terrace) + for (int row = 0; row < grid.Rows; row++) + for (int col = 0; col < grid.Columns; col++) + if (grid.IsBlocked(col, row)) + space.Block(area.min + new Vector2((col + .5f) * grid.CellLength, (row + .5f) * grid.CellWidth), + new Vector2(grid.CellLength, grid.CellWidth)); + foreach (SunDeckPlacement placement in grid.Existing) + { + Rect footprint = grid.Bounds(placement, grid.SelectedPool); + space.Block(footprint.center, footprint.size - Vector2.one * .8f); + } + float eye = MegaDeckGeometry.RoofHeight(displayedShip.Decks.Count, zone) + 1.64f; + Vector3 entrance = terrace ? new Vector3(area.xMax - .8f, eye, area.yMax + .8f) + : new Vector3(area.center.x, eye, area.yMax - .8f); + entrance = space.Entry(entrance); + if (!space.CanStand(entrance)) + { + for (int row = 0; row < grid.Rows && !space.CanStand(entrance); row++) + for (int col = 0; col < grid.Columns && !space.CanStand(entrance); col++) + entrance = new Vector3(area.xMin + (col + .5f) * grid.CellLength, eye, + area.yMin + (row + .5f) * grid.CellWidth); + if (!space.CanStand(entrance)) + return false; + } + EnterWalk(CameraMode.OutdoorWalk, space, entrance, 68f, 2f, terrace ? -90f : 90f); + return true; + } + public void ViewBridge() { if (!sailing || decks == null) @@ -424,9 +481,7 @@ namespace BigShipTycoon Vector3 focus = home + offset; if (deckIndex >= 0) { - float length = VesselExterior.DeckLength(vesselLength, deckIndex); - float center = VesselExterior.DeckOffset(vesselLength, deckIndex); - float halfBeam = VesselExterior.DeckHalfBeam(vesselBeam, deckIndex); + var (length, halfBeam, center) = MegaDeckGeometry.ForShip(displayedShip, deckIndex, displayedShip.Decks.Count); focus.x = Mathf.Clamp(focus.x, center - length * .45f, center + length * .40f); focus.y = home.y; focus.z = Mathf.Clamp(focus.z, -halfBeam, halfBeam); @@ -618,7 +673,7 @@ namespace BigShipTycoon vesselLength = ship.Hull.Length; float beam = vesselBeam = ship.Hull.Beam * .5f; - vesselTop = VesselExterior.DeckBase + deckCount * VesselExterior.DeckSpacing + 5.95f; + vesselTop = VesselExterior.DeckBase + deckCount * VesselExterior.DeckSpacing + (ship.HasAftTerrace ? 10.5f : 5.95f); water.SetVector("_HullSpan", new Vector4(vesselLength, beam, 0, 0)); hullBounds = new Bounds(new Vector3(0, (vesselTop - 2.65f) * .5f, 0), new Vector3(vesselLength * 1.05f, vesselTop + 2.65f, beam * 2.26f)); @@ -681,6 +736,10 @@ namespace BigShipTycoon VesselExterior.Paint.StarboardLight => ("4DCA8E", .25f, .05f, .90f, 0f), VesselExterior.Paint.Turf => ("5F8E54", .92f, 0f, 0f, .08f), VesselExterior.Paint.Fringe => ("375D3D", .95f, 0f, 0f, .12f), + VesselExterior.Paint.MegaHull => ("E8E9DF", .35f, .18f, 0f, .22f), + VesselExterior.Paint.AtriumGlass => ("154450", .16f, .53f, 0f, .07f), + VesselExterior.Paint.DeckTrack => ("A85E4E", .83f, .02f, 0f, .21f), + VesselExterior.Paint.FritGlass => ("6F8794", .25f, .38f, 0f, .08f), _ => ("318994", .16f, .40f, .05f, .13f) }; ColorUtility.TryParseHtmlString("#" + hex, out Color color); @@ -690,16 +749,20 @@ namespace BigShipTycoon material.SetFloat("_Emissive", emissive); material.SetFloat("_Weather", weather); material.SetFloat("_Waterline", paint is VesselExterior.Paint.Navy or VesselExterior.Paint.Antifouling - or VesselExterior.Paint.Black ? 1f : 0f); + or VesselExterior.Paint.Black or VesselExterior.Paint.MegaHull ? 1f : 0f); SurfaceFinish finish = paint switch { - VesselExterior.Paint.Teak => SurfaceFinish.Timber, + VesselExterior.Paint.Teak or VesselExterior.Paint.TeakSeam => SurfaceFinish.Timber, VesselExterior.Paint.Glass or VesselExterior.Paint.BlueGlass or VesselExterior.Paint.LitGlass - or VesselExterior.Paint.Lounge => SurfaceFinish.Glass, + or VesselExterior.Paint.Lounge or VesselExterior.Paint.AtriumGlass => SurfaceFinish.Glass, VesselExterior.Paint.DeckCanvas => SurfaceFinish.Fabric, VesselExterior.Paint.Steel or VesselExterior.Paint.Gold => SurfaceFinish.Alloy, - VesselExterior.Paint.Navy or VesselExterior.Paint.Antifouling => SurfaceFinish.Hull, + VesselExterior.Paint.Navy or VesselExterior.Paint.Antifouling or VesselExterior.Paint.MegaHull => SurfaceFinish.Hull, + VesselExterior.Paint.Ivory => SurfaceFinish.Panel, VesselExterior.Paint.Pool => SurfaceFinish.Pool, + VesselExterior.Paint.Turf or VesselExterior.Paint.Fringe => SurfaceFinish.Turf, + VesselExterior.Paint.DeckTrack => SurfaceFinish.Aggregate, + VesselExterior.Paint.FritGlass => SurfaceFinish.FritGlass, _ => SurfaceFinish.Paint }; material.SetFloat("_Finish", (float)finish); diff --git a/Assets/BigShipTycoon/Runtime/HarborCinematic.cs b/Assets/BigShipTycoon/Runtime/HarborCinematic.cs index 0f7599f..333f0d3 100644 --- a/Assets/BigShipTycoon/Runtime/HarborCinematic.cs +++ b/Assets/BigShipTycoon/Runtime/HarborCinematic.cs @@ -6,24 +6,25 @@ namespace BigShipTycoon public sealed partial class Harbor { internal const float PortCinematicDuration = 4.2f; - private const float QuayLength = 174f, QuayWidth = 12f; + private const float RegionalQuayLength = 174f, QuayWidth = 12f; private readonly List quayMeshes = new(); private readonly List quayFinishes = new(); private GameObject portQuay; private int cinematicPort = -1; private bool portArrival; - private float portFrame; + private float portFrame, quayLength; private Vector3 resumeVesselPosition, resumeWaterPosition; private Quaternion resumeVesselRotation; private Vector4 resumeHull, resumeCourse; internal bool PortCinematicActive => cinematicPort >= 0; + private bool MegaPortBerth => displayedShip?.HullIndex == Market.Mega; internal (Vector2 Near, Vector2 Far, Vector4 Matte) PortCinematicAlignment() { Vector3 edge = new(0, 1.4f, -QuayWidth * .5f); - Vector3 near = portQuay.transform.TransformPoint(edge - Vector3.right * QuayLength * .45f); - Vector3 far = portQuay.transform.TransformPoint(edge + Vector3.right * QuayLength * .45f); + Vector3 near = portQuay.transform.TransformPoint(edge - Vector3.right * quayLength * .45f); + Vector3 far = portQuay.transform.TransformPoint(edge + Vector3.right * quayLength * .45f); return (viewCamera.WorldToViewportPoint(near), viewCamera.WorldToViewportPoint(far), water.GetVector("_PortMatteCrop")); } @@ -42,10 +43,17 @@ namespace BigShipTycoon resumeHull = water.GetVector("_HullSpan"); resumeCourse = water.GetVector("_HullCourse"); - portQuay ??= BuildPortQuay(); - portQuay.transform.localPosition = new Vector3(vesselLength * .27f, 0, vesselBeam + 2.05f + QuayWidth * .5f); + float berthLength = MegaPortBerth ? vesselLength + 44f : RegionalQuayLength; + if (portQuay == null || !Mathf.Approximately(quayLength, berthLength)) + { + ReleaseCinematicQuay(); + quayLength = berthLength; + portQuay = BuildPortQuay(); + } + float berthCenter = vesselLength * (MegaPortBerth ? .016f : .27f); + portQuay.transform.localPosition = new Vector3(berthCenter, 0, vesselBeam + 2.05f + QuayWidth * .5f); Vector3 quay = portQuay.transform.position; - water.SetVector("_PortBerth", new Vector4(quay.x, quay.z, QuayLength * .5f, QuayWidth * .5f)); + water.SetVector("_PortBerth", new Vector4(quay.x, quay.z, quayLength * .5f, QuayWidth * .5f)); portQuay.SetActive(true); ShowPortScenery(port); water.SetFloat("_Underway", 0); @@ -110,21 +118,23 @@ namespace BigShipTycoon private (Vector2 Center, float Heading, float Knots) PortMotion(float t) { float run = PortRun; + // The stern of the longer hull sweeps farther out from the pivot during a turn. + float turn = MegaPortBerth ? .68f : 1f; if (portArrival) { float slowing = t * (2f - t); float approach = Mathf.SmoothStep(0, 1, t); return (new Vector2((slowing - .88f) * run, -(1f - approach) * (8.5f + vesselBeam * .31f)), - -12f * (1f - approach), Mathf.Lerp(11.8f, .35f, Mathf.Clamp01(t))); + -12f * turn * (1f - approach), Mathf.Lerp(11.8f, .35f, Mathf.Clamp01(t))); } float leaving = t * (.21f + t * .79f); float castOff = Mathf.SmoothStep(0, 1, t); return (new Vector2((leaving - .35f) * run, -castOff * (9f + vesselBeam * .31f)), - castOff * 10.5f, Mathf.Lerp(1.4f, 12.6f, t)); + castOff * 10.5f * turn, Mathf.Lerp(1.4f, 12.6f, t)); } - private float PortRun => Mathf.Min(35f, vesselLength * .38f); + private float PortRun => MegaPortBerth ? vesselLength * .18f : Mathf.Min(35f, vesselLength * .38f); private static Vector2 PortBow(float heading) { @@ -183,17 +193,19 @@ namespace BigShipTycoon var paint = new HarborMesh(); var lantern = new HarborMesh(); float edge = -QuayWidth * .5f; - concrete.Box(new Vector3(0, .5f, 0), new Vector3(QuayLength, 1.32f, QuayWidth)); - caps.Box(new Vector3(0, 1.24f, 0), new Vector3(QuayLength + .3f, .19f, QuayWidth + .20f)); - caps.Box(new Vector3(0, 1.43f, edge + .10f), new Vector3(QuayLength, .24f, .48f)); - paint.Box(new Vector3(0, 1.34f, edge + .61f), new Vector3(QuayLength - .35f, .026f, .085f)); - steel.Box(new Vector3(0, 1.41f, -edge - .37f), new Vector3(QuayLength - .3f, .16f, .19f)); - for (int station = -9; station <= 9; station++) + concrete.Box(new Vector3(0, .5f, 0), new Vector3(quayLength, 1.32f, QuayWidth)); + caps.Box(new Vector3(0, 1.24f, 0), new Vector3(quayLength + .3f, .19f, QuayWidth + .20f)); + caps.Box(new Vector3(0, 1.43f, edge + .10f), new Vector3(quayLength, .24f, .48f)); + paint.Box(new Vector3(0, 1.34f, edge + .61f), new Vector3(quayLength - .35f, .026f, .085f)); + steel.Box(new Vector3(0, 1.41f, -edge - .37f), new Vector3(quayLength - .3f, .16f, .19f)); + const float stationSpacing = 9.52f; + int stations = Mathf.FloorToInt(quayLength / (2 * stationSpacing)); + for (int station = -stations; station <= stations; station++) { - float x = station * 9.52f; + float x = station * stationSpacing; fenders.Box(new Vector3(x, .61f, edge - .079f), new Vector3(.64f, 1.04f, .29f)); - if (station < 9) - fenders.Box(new Vector3(x + 4.76f, 1.33f, 0), new Vector3(.031f, .021f, QuayWidth - 1.6f)); + if (station < stations) + fenders.Box(new Vector3(x + stationSpacing * .5f, 1.33f, 0), new Vector3(.031f, .021f, QuayWidth - 1.6f)); Vector3 foot = new Vector3(x, 1.33f, edge + 1.54f); steel.Rod(foot, foot + Vector3.up * .48f, .14f, 8, true); steel.Rod(foot + new Vector3(-.23f, .42f, 0), foot + new Vector3(.23f, .42f, 0), .10f, 8, true); @@ -234,10 +246,23 @@ namespace BigShipTycoon private void ReleasePortQuay() { portScenery?.Release(); + ReleaseCinematicQuay(); + } + + private void ReleaseCinematicQuay() + { + if (portQuay != null) + { + portQuay.SetActive(false); + Destroy(portQuay); + portQuay = null; + } foreach (Mesh mesh in quayMeshes) Destroy(mesh); foreach (Material material in quayFinishes) Destroy(material); + quayMeshes.Clear(); + quayFinishes.Clear(); } } } diff --git a/Assets/BigShipTycoon/Runtime/HarborPortScenery.cs b/Assets/BigShipTycoon/Runtime/HarborPortScenery.cs index 0219e18..9c6601b 100644 --- a/Assets/BigShipTycoon/Runtime/HarborPortScenery.cs +++ b/Assets/BigShipTycoon/Runtime/HarborPortScenery.cs @@ -127,6 +127,9 @@ namespace BigShipTycoon Coat.Roof or Coat.Brick => 2, Coat.Glass or Coat.GlassLit => 3, Coat.Foliage or Coat.FoliageLight => 4, + Coat.Wood => 5, + Coat.Street => 6, + Coat.Steel => 7, _ => 0 }); material.SetFloat("_Glow", coat == Coat.GlassLit ? .28f : 0f); diff --git a/Assets/BigShipTycoon/Runtime/Market.cs b/Assets/BigShipTycoon/Runtime/Market.cs index 65f837d..552897f 100644 --- a/Assets/BigShipTycoon/Runtime/Market.cs +++ b/Assets/BigShipTycoon/Runtime/Market.cs @@ -10,7 +10,9 @@ namespace BigShipTycoon { Empty, Cabin, Dining, Entertainment, Tank, Bar, Amenity, Galley, Stores, Water, Waste, Workshop, Suite, GrandSuite, Restaurant, GrandTheater, ResortPool, CocktailLounge, Extension, - Shop, ShoppingArcade, Spa, WaterPark, Casino, CasinoLounge, GrandCasino + Shop, ShoppingArcade, Spa, WaterPark, Casino, CasinoLounge, GrandCasino, + SkyResidence, MarketHall, OceanArena, BunkerFarm, PanoramaClub, ThermalSpa, ProductionGalley, ColdChain, + MembranePlant, ReclamationPlant, EngineeringCenter, Galleria, RoyalCasino, LaundryPlant } public sealed class FacilitySpec @@ -135,6 +137,7 @@ namespace BigShipTycoon public const int Coastal = 0; public const int Regional = 1; public const int Ocean = 2; + public const int Mega = 3; public const int Bermuda = 5; public const int Lisbon = 7; public const int MinFare = 150; @@ -167,16 +170,51 @@ namespace BigShipTycoon new FacilitySpec("Water park", "WP", "460 amenity admissions per service", 107000, 460, 3, Ocean, depth: 2), new FacilitySpec("Casino", "CS", "144 gaming seats · table stakes and guest payouts", 57900, 144, 2, Regional, depth: 2), new FacilitySpec("Casino lounge", "CG", "54 gaming seats · table stakes and guest payouts", 32700, 54, 2), - new FacilitySpec("Grand casino", "GC", "264 gaming seats · table stakes and guest payouts", 109000, 264, 3, Ocean, depth: 2) + new FacilitySpec("Grand casino", "GC", "264 gaming seats · table stakes and guest payouts", 109000, 264, 3, Ocean, depth: 2), + new FacilitySpec("Sky residences", "SR", "128 suite berths · 140% above base fare", 188000, 128, 4, Mega, 140, depth: 2), + new FacilitySpec("Market hall", "MH", "280 dining seats · 3 services", 148000, 280, 4, Mega, depth: 2), + new FacilitySpec("Ocean arena", "OA", "720 show seats", 270000, 720, 4, Mega, depth: 2), + new FacilitySpec("Bunker farm", "BF", "+320 t of fuel capacity", 110000, 320, 3, Mega, depth: 2), + new FacilitySpec("Panorama club", "PC", "340 drink orders per service", 131000, 340, 3, Mega, depth: 2), + new FacilitySpec("Thermal spa", "TS", "480 amenity admissions per service", 176000, 480, 3, Mega, depth: 2), + new FacilitySpec("Production galley", "PG", "+360 meals per service window", 126000, 360, 3, Mega, depth: 2), + new FacilitySpec("Cold chain stores", "CC", "+5,400 meal portions of storage", 106000, 5400, 3, Mega, depth: 2), + new FacilitySpec("Membrane plant", "MP", "+60,000 L storage and +36,000 L/day output", 131000, 60000, 3, Mega, depth: 2), + new FacilitySpec("Water reclamation", "WR", "+44,000 L buffer and +40,000 L/day treatment", 127000, 44000, 3, Mega, depth: 2), + new FacilitySpec("Engineering center", "EC", "+5 onboard repair credit per service", 104000, 5, 3, Mega, depth: 2), + new FacilitySpec("Galleria", "GA", "590 retail orders per service", 195000, 590, 4, Mega, depth: 2, corner: true), + new FacilitySpec("Royal casino", "RC", "640 gaming seats · table stakes and guest payouts", 240000, 640, 4, Mega, depth: 2), + new FacilitySpec("Laundry plant", "LP", "+380 loads/day with sufficient crew", 92000, 380, 2, Mega, depth: 2) }; - internal static bool IsCasino(Facility facility) => facility is Facility.Casino or Facility.CasinoLounge or Facility.GrandCasino; + internal static Facility BaseFacility(Facility facility) => facility switch + { + Facility.SkyResidence => Facility.GrandSuite, + Facility.MarketHall => Facility.Restaurant, + Facility.OceanArena => Facility.GrandTheater, + Facility.BunkerFarm => Facility.Tank, + Facility.PanoramaClub => Facility.CocktailLounge, + Facility.ThermalSpa => Facility.Spa, + Facility.ProductionGalley => Facility.Galley, + Facility.ColdChain => Facility.Stores, + Facility.MembranePlant => Facility.Water, + Facility.ReclamationPlant => Facility.Waste, + Facility.EngineeringCenter => Facility.Workshop, + Facility.Galleria => Facility.ShoppingArcade, + Facility.RoyalCasino => Facility.GrandCasino, + Facility.LaundryPlant => Facility.Workshop, + _ => facility + }; + + internal static bool IsCasino(Facility facility) => BaseFacility(facility) is Facility.Casino or Facility.CasinoLounge or Facility.GrandCasino; public static readonly IReadOnlyList Hulls = new[] { new HullSpec("Coastal", "A compact hull for short Caribbean crossings.", 6, 2, 2, 3, 210000, 0, 0, 74, .092, 7200, 1200, 72, 14), new HullSpec("Regional", "More deck space and range for island chains.", 8, 3, 4, 5, 355000, 3, 24, 185, .121, 12800, 2300, 104, 19), - new HullSpec("Ocean Class", "A transatlantic hull for a world-class flagship.", 10, 3, 6, 8, 690000, 9, 42, 440, .152, 21800, 4700, 142, 25) + new HullSpec("Ocean Class", "A transatlantic hull for a world-class flagship.", 10, 3, 6, 8, 690000, 9, 42, 440, .152, 21800, 4700, 142, 25), + new HullSpec("MEGA Ocean Liner", "A 300-meter flagship with split outdoor decks and space for full-scale venues and utilities.", + 16, 4, 12, 15, 2350000, 18, 65, 1160, .255, 42200, 12800, 300, 48) }; public static readonly IReadOnlyList Ports = new[] diff --git a/Assets/BigShipTycoon/Runtime/MegaDeckGeometry.cs b/Assets/BigShipTycoon/Runtime/MegaDeckGeometry.cs new file mode 100644 index 0000000..b47da04 --- /dev/null +++ b/Assets/BigShipTycoon/Runtime/MegaDeckGeometry.cs @@ -0,0 +1,43 @@ +using UnityEngine; + +namespace BigShipTycoon +{ + public enum SunDeckZone { Sky, AftTerrace } + + internal static class MegaDeckGeometry + { + internal static (float Length, float Beam, float Offset) ForShip(Ship ship, int deck, int deckCount) + { + float length = ship.Hull.Length, halfBeam = ship.Hull.Beam * .5f; + return ship.HullIndex == Market.Mega ? Footprint(length, halfBeam, deck, deckCount) + : (VesselExterior.DeckLength(length, deck), VesselExterior.DeckHalfBeam(halfBeam, deck), + VesselExterior.DeckOffset(length, deck)); + } + + internal static (float Length, float Beam, float Offset) Footprint(float length, float halfBeam, int deck, int deckCount) + { + bool sky = deck == deckCount - 1; + float aft = sky ? -.215f : -.444f + deck * .0018f; + float fore = .458f - deck * .0041f; + float width = halfBeam * (.952f - deck * .010f - (sky ? .027f : 0)); + return ((fore - aft) * length, width, (fore + aft) * length * .5f); + } + + internal static Rect TerraceArea(float length, float halfBeam, int deckCount) + { + float width = halfBeam * .49f; + return new Rect(-length * .367f, -width, length * .134f, 2 * width); + } + + internal static float BridgeCenter(Ship ship, int deckCount) + { + if (ship.HullIndex != Market.Mega) + return VesselExterior.BridgeCenter(ship.Hull.Length, deckCount); + var (length, _, offset) = ForShip(ship, deckCount - 1, deckCount); + return offset + length * .285f; + } + + internal static float RoofHeight(int count, SunDeckZone zone) => VesselExterior.DeckBase + + (count - (zone == SunDeckZone.AftTerrace ? 1 : 0)) * VesselExterior.DeckSpacing; + } +} diff --git a/Assets/BigShipTycoon/Runtime/MegaDeckGeometry.cs.meta b/Assets/BigShipTycoon/Runtime/MegaDeckGeometry.cs.meta new file mode 100644 index 0000000..3b689d3 --- /dev/null +++ b/Assets/BigShipTycoon/Runtime/MegaDeckGeometry.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 1561872562a6d2ddb840bb5d8a3395d8 \ No newline at end of file diff --git a/Assets/BigShipTycoon/Runtime/MegaVenues.cs b/Assets/BigShipTycoon/Runtime/MegaVenues.cs new file mode 100644 index 0000000..1152840 --- /dev/null +++ b/Assets/BigShipTycoon/Runtime/MegaVenues.cs @@ -0,0 +1,397 @@ +using System.Collections.Generic; +using UnityEngine; + +namespace BigShipTycoon +{ + internal sealed partial class DeckPassengers + { + private static void FitMegaVenue(Venue room, Facility facility, float width, float depth, bool bookedStage) + { + switch (facility) + { + case Facility.SkyResidence: FitSkyResidence(room, width, depth); break; + case Facility.MarketHall: FitMarketHall(room, width, depth, bookedStage); break; + case Facility.OceanArena: FitOceanArena(room, width, depth, bookedStage); break; + case Facility.PanoramaClub: FitPanoramaClub(room, width, depth); break; + case Facility.ThermalSpa: FitThermalSpa(room, width, depth); break; + case Facility.RoyalCasino: FitRoyalCasino(room, width, depth); break; + default: FitMegaUtility(room, facility, width, depth); break; + } + } + + private static void FitSkyResidence(Venue room, float width, float depth) + { + float head = depth * .33f; + for (int side = -1; side <= 1; side += 2) + { + float x = side * width * .30f; + room.Box(SuiteCarpet, x, .012f, head - .89f, 4.40f, .021f, 3.66f); + room.Solid(Joinery, x, .25f, head - .78f, 2.49f, .50f, 2.30f); + room.Box(Linen, x, .58f, head - .78f, 2.42f, .16f, 2.22f); + room.Box(PoolTile, x, .681f, head - 1.49f, 2.38f, .068f, .51f); + room.Solid(LoungeLeather, x, .76f, head + .44f, 3.03f, 1.51f, .19f); + for (int pillow = -1; pillow <= 1; pillow += 2) + { + room.Box(Ivory, x + pillow * .57f, .72f, head + .04f, .65f, .17f, .39f); + float foot = x + pillow * 1.66f; + room.Solid(Joinery, foot, .36f, head + .12f, .54f, .72f, .61f); + room.Box(Marble, foot, .743f, head + .12f, .58f, .052f, .66f); + room.Cylinder(Brass, foot, .77f, head + .12f, .27f, .026f); + room.Cylinder(LightStrip, foot, 1.03f, head + .12f, .19f, .135f); + } + + float alcove = side * width * .395f; + room.Solid(Joinery, alcove, .97f, -depth * .22f, 1.02f, 1.94f, 2.49f); + room.Box(Brass, alcove - side * .53f, 1.02f, -depth * .22f, .065f, .32f, .06f); + room.Solid(LoungeLeather, side * 2.09f, .25f, 1.5f, 3.46f, .50f, .76f); + room.Box(Linen, side * 2.09f, .62f, 1.82f, 3.44f, .29f, .16f); + room.Guest(GuestActivity.Read, side * 2.64f, 1.54f, 13 + side, OnboardService.Rooms, .22f, .51f, -1); + FitPlanter(room, side * width * .43f, depth * .35f); + } + + room.Box(SuiteCarpet, 0, .012f, .53f, 8.0f, .019f, 4.25f); + room.Solid(Joinery, 0, .20f, .57f, 2.94f, .40f, .94f); + room.Box(Marble, 0, .43f, .57f, 3.09f, .066f, 1.08f); + room.Box(Brass, 0, .475f, .57f, .57f, .026f, .23f); + room.Solid(Marble, 0, .47f, -depth * .34f, 1.78f, .94f, .63f); + room.Box(Joinery, 0, .79f, -depth * .34f - .33f, 1.52f, .23f, .046f); + room.Station(StationKind.Cabins, 0, -depth * .34f - .51f); + } + + private static void FitMarketHall(Venue room, float width, float depth, bool bookedStage) + { + int counters = Mathf.Clamp(Mathf.FloorToInt(width / 6f), 3, 9); + int rows = Mathf.Clamp(Mathf.FloorToInt(depth / 4.6f), 2, 5); + float line = depth * .33f; + room.Box(Marble, 0, .013f, line, width * .93f, .021f, 3.3f); + for (int bay = 0; bay < counters; bay++) + { + float x = Mathf.Lerp(-width * .42f, width * .42f, (float)bay / (counters - 1)); + room.Solid(Joinery, x, .49f, line, 2.74f, .98f, 1.06f); + room.Box(Marble, x, 1.01f, line, 2.88f, .073f, 1.16f); + room.Box(bay % 2 == 0 ? PoolTile : ShowVelvet, x, .68f, line - .545f, 2.38f, .35f, .055f); + room.Box(WindowGlass, x, 1.192f, line + .22f, 2.52f, .24f, .48f); + room.Box(Brass, x, 1.356f, line + .23f, 2.44f, .038f, .05f); + room.Box(DeckTrim, x, 2.24f, line + .10f, 2.45f, .28f, .60f); + room.Box(LightStrip, x, 2.17f, line - .215f, 2.31f, .07f, .018f); + for (int tray = -1; tray <= 1; tray++) + room.Box((bay + tray + 9) % 2 == 0 ? ScreenAmber : SafetyGreen, x + tray * .66f, 1.08f, line + .18f, .42f, .071f, .28f); + + for (int row = 0; row < rows; row++) + { + float z = Mathf.Lerp(-depth * .34f, depth * .13f, (float)row / (rows - 1)); + if (bay == counters / 2) + continue; + room.Box(Joinery, x, .36f, z, .25f, .72f, .66f); + room.Solid(Marble, x, .76f, z, 1.46f, .066f, .81f); + for (int side = -1; side <= 1; side += 2) + { + float seat = x + .31f * side; + room.Cylinder(Ivory, seat, .799f, z - .12f, .018f, .125f); + room.Cylinder(PoolTile, seat + .20f, .795f, z - .02f, .10f, .033f); + room.Seat(seat, z - .68f, LoungeLeather); + room.Guest(GuestActivity.Dine, seat, z - .68f, 31 + bay * 13 + row * 5 + side, + OnboardService.Meals, .16f + row * .075f + (bay % 4) * .10f, ChairSeatHeight); + } + } + } + float host = depth * .16f; + room.Solid(DeckTrim, 0, .48f, host, 1.26f, .96f, .40f); + room.Box(Marble, 0, .989f, host, 1.33f, .059f, .45f); + room.Box(Brass, 0, .73f, host - .205f, .95f, .042f, .028f); + room.Station(StationKind.Dining, 0, host - .48f); + if (bookedStage) + room.Guest(GuestActivity.Guitar, 0, line + 1.18f, 83, OnboardService.Shows, .22f, + direction: -1, program: EntertainmentProgram.LiveMusic); + } + + private static void FitOceanArena(Venue room, float width, float depth, bool bookedStage) + { + float stage = depth * .27f; + float stageWidth = Mathf.Min(width * .62f, 22f); + room.Solid(DeckTrim, 0, .198f, stage, stageWidth, .396f, 2.76f); + room.Solid(Joinery, 0, .197f, stage - 2.01f, stageWidth * .29f, .394f, 1.34f); + room.Box(Brass, 0, .418f, stage - 1.379f, stageWidth, .033f, .054f); + room.Box(LightStrip, 0, .295f, stage - 1.388f, stageWidth * .96f, .038f, .031f); + room.Solid(DisplayDark, 0, 1.05f, stage + 1.62f, stageWidth, 2.10f, .19f); + for (int panel = -8; panel <= 8; panel++) + { + float x = panel * stageWidth / 18; + float top = 1.09f + .58f * Mathf.Cos(panel * .42f); + room.Box(ScreenWater, x, 1.15f, stage + 1.513f, stageWidth / 18 - .026f, 1.26f, .024f); + room.Box(ScreenChart, x, top, stage + 1.492f, stageWidth / 18 - .028f, .082f, .021f); + } + + int rows = Mathf.Clamp(Mathf.FloorToInt(depth / 2.80f), 4, 9); + int seats = Mathf.Clamp(Mathf.FloorToInt(width / 3), 6, 12); + for (int row = 0; row < rows; row++) + { + float z = Mathf.Lerp(-depth * .38f, stage - 3.31f, (float)row / (rows - 1)); + for (int side = -1; side <= 1; side += 2) + for (int seat = 0; seat < seats; seat++) + { + float x = side * Mathf.Lerp(Mathf.Max(1.9f, stageWidth * .18f), width * .43f, (float)seat / (seats - 1)); + room.Seat(x, z, row % 3 == 2 ? Upholstery : ShowVelvet); + room.Guest(GuestActivity.Watch, x, z, 110 + row * 53 + side * 17 + seat, OnboardService.Shows, + .11f + .10f * ((row + seat) % 7), ChairSeatHeight); + } + } + room.Station(StationKind.Stage, 0, stage - 3.22f); + room.Guest(GuestActivity.Perform, 0, stage, 131, OnboardService.Shows, .07f, direction: -1, lift: .404f); + if (bookedStage) + { + room.Guest(GuestActivity.Guitar, -.72f, stage, 132, OnboardService.Shows, .17f, + direction: -1, lift: .404f, program: EntertainmentProgram.LiveMusic); + for (int side = -1; side <= 1; side += 2) + room.Guest(GuestActivity.Revue, side * 2.16f, stage - .40f, 136 + side, OnboardService.Shows, .19f, + direction: -1, lift: .404f, program: EntertainmentProgram.Headline); + } + } + + private static void FitPanoramaClub(Venue room, float width, float depth) + { + FitCocktailLounge(room, width * .92f, depth); + float wall = depth * .438f; + float span = width * .10f; + for (int side = -1; side <= 1; side += 2) + { + for (int bay = 0; bay < 3; bay++) + { + float x = side * (width * .13f + span * bay); + room.Box(ScreenWater, x, 2.01f, wall, span * .87f, .26f, .058f); + room.Box(Brass, x, 2.17f, wall, span * .94f, .031f, .078f); + float z = -depth * .28f; + room.Box(SuiteCarpet, x, .015f, z, 2.64f, .018f, 2.38f); + room.Solid(LoungeLeather, x, .24f, z + .55f, 2.18f, .48f, .55f); + room.Box(Linen, x, .62f, z + .78f, 2.08f, .29f, .13f); + room.Solid(Joinery, x, .23f, z - .24f, .64f, .46f, .56f); + room.Box(Marble, x, .495f, z - .24f, .85f, .067f, .73f); + room.Guest(GuestActivity.Drink, x + .33f, z + .55f, 161 + side * 9 + bay, OnboardService.Drinks, .28f + bay * .17f, .48f, -1); + } + FitPlanter(room, side * width * .44f, -depth * .34f); + } + room.Station(StationKind.Bar, 0, depth * .13f - .74f); + } + + private static void FitThermalSpa(Venue room, float width, float depth) + { + var basin = new Vector2(Mathf.Min(width * .272f, 7.7f), Mathf.Min(depth * .134f, 2.4f)); + for (int side = -1; side <= 1; side += 2) + { + float z = side * depth * .234f; + room.Pool(z, basin, .59f, .465f); + FitPoolSurround(room, z, basin); + room.Swimmer(0, .465f, z + .32f, basin.x * .65f, 182 + side, .16f); + room.Guest(GuestActivity.Wade, -basin.x * .71f, z - .25f, 190 + side, OnboardService.Amenities, .36f, lift: .465f); + for (int end = -1; end <= 1; end += 2) + { + float x = end * width * .41f; + room.Solid(Marble, x, .237f, z, 1.56f, .47f, .69f); + room.Box(Linen, x, .497f, z, 1.43f, .052f, .59f); + room.Guest(GuestActivity.Rest, x, z, 194 + end + 7 * side, OnboardService.Amenities, .34f, .51f, -1); + FitPlanter(room, end * width * .42f, z + side * 1.94f); + } + } + room.Station(StationKind.Pool, 0, 0); + } + + private static void FitRoyalCasino(Venue room, float width, float depth) + { + FitCasino(room, Facility.GrandCasino, width, depth); + room.Box(Marble, 0, .012f, 0, 2.2f, .020f, depth * .64f); + room.Box(Brass, 1.04f, .025f, 0, .032f, .023f, depth * .63f); + room.Box(Brass, -1.04f, .025f, 0, .032f, .023f, depth * .63f); + for (int side = -1; side <= 1; side += 2) + { + float x = side * width * .355f; + for (int row = -1; row <= 1; row++) + { + float z = row * depth * .24f - .14f; + room.Solid(Joinery, x, .318f, z, 1.10f, .635f, .71f); + room.Box(Brass, x, .642f, z, 1.13f, .036f, .75f); + room.Box(CasinoFelt, x, .673f, z, .97f, .028f, .59f); + room.Cylinder(Brass, x, .691f, z, .062f, .25f); + for (int n = 0; n < 8; n++) + { + float angle = n * Mathf.PI / 4; + room.Cylinder(n % 2 == 0 ? ScreenRed : DisplayDark, x + Mathf.Cos(angle) * .202f, .752f, + z + Mathf.Sin(angle) * .202f, .018f, .026f); + } + room.Seat(x, z - .75f, ShowVelvet); + room.Guest(GuestActivity.PlayCards, x, z - .75f, 207 + row * 3 + side, OnboardService.Casino, .23f + .16f * (row + 1), ChairSeatHeight); + } + } + } + + private static void FitMegaGalleria(Geometry shape, Layout layout, DeckGrid grid, IReadOnlyList footprint, + int column, int row, float floor, int rotation, int seed) + { + for (int i = 0; i < footprint.Count; i++) + { + Vector2Int bay = footprint[i]; + int bayRow = row + bay.y; + var center = new Vector3(grid.Center(column + bay.x), floor + .06f, grid.Row(bayRow)); + float width = grid.CellWidth - .19f, depth = grid.RowDepth - .18f; + if ((rotation & 1) != 0) + (width, depth) = (depth, width); + var shop = new Venue(shape, layout, center, bayRow == 0 ? -1 : 1, seed + i * 13, rotation); + FitRetail(shop, width, depth, i == 0, i); + shop.Box(Marble, .04f, .032f, -depth * .34f, width * .81f, .016f, .47f); + shop.Box(Brass, 0, .046f, -depth * .36f - .22f, width * .84f, .019f, .025f); + shop.Box(i % 2 == 0 ? PoolTile : LoungeLeather, 0, 2.09f, depth * .38f, width * .42f, .21f, .12f); + shop.Box(LightStrip, 0, 2.05f, depth * .38f - .068f, width * .39f, .044f, .021f); + FitPlanter(shop, width * .38f, -depth * .19f); + } + } + + private static void FitMegaUtility(Venue room, Facility facility, float width, float depth) + { + int banks = Mathf.Clamp(Mathf.FloorToInt(width / 4.2f), 3, 10); + float front = -depth * .36f; + float back = depth * .31f; + float span = width * .78f; + room.Box(BridgeFloor, 0, .013f, front + .76f, width * .93f, .019f, 1.68f); + room.Box(ScreenAmber, 0, .026f, front + 1.53f, width * .93f, .012f, .063f); + int accent = facility switch + { + Facility.BunkerFarm => ScreenAmber, Facility.MembranePlant => ScreenChart, Facility.ReclamationPlant => SafetyGreen, + Facility.ColdChain => PoolTile, Facility.ProductionGalley => ScreenRed, _ => ScreenGreen + }; + for (int bay = 0; bay < banks; bay++) + { + float x = Mathf.Lerp(-span / 2, span / 2, (float)bay / (banks - 1)); + switch (facility) + { + case Facility.BunkerFarm: + case Facility.MembranePlant: + case Facility.ReclamationPlant: + FitUtilityVessel(room, x, back, accent, facility); + break; + case Facility.ColdChain: + FitColdRack(room, x, back, bay); + FitColdRack(room, x, 0, bay + 1); + break; + case Facility.LaundryPlant: + FitLaundryBank(room, x, back); + FitServiceBench(room, x, 0, Linen, false); + break; + case Facility.ProductionGalley: + FitServiceBench(room, x, back, ScreenRed, true); + FitServiceBench(room, x, 0, Ivory, false); + break; + default: + FitServiceBench(room, x, back, ScreenChart, false); + FitEngineeringRack(room, x, 0, bay); + break; + } + } + if (facility is Facility.BunkerFarm or Facility.MembranePlant or Facility.ReclamationPlant) + { + room.Rod(Alloy, new Vector3(-span * .52f, 1.97f, back + .64f), new Vector3(span * .52f, 1.97f, back + .64f), .065f); + room.Rod(accent, new Vector3(-span * .52f, 1.74f, back + .75f), new Vector3(span * .52f, 1.74f, back + .75f), .044f); + } + room.Solid(DeckTrim, 0, .52f, front + .78f, 1.32f, 1.04f, .50f); + room.Box(DisplayDark, 0, 1.084f, front + .78f, 1.39f, .115f, .61f); + room.Box(accent, -.18f, 1.154f, front + .78f, .51f, .033f, .29f); + for (int dial = -1; dial <= 1; dial++) + room.Cylinder(Alloy, .32f + dial * .115f, 1.15f, front + .745f, .041f, .039f); + if (FacilityStation(facility) is StationKind station) + room.Station(station, 0, front + 1.23f); + } + + private static void FitUtilityVessel(Venue room, float x, float z, int accent, Facility facility) + { + float radius = facility == Facility.ReclamationPlant ? .72f : .52f; + float height = facility == Facility.BunkerFarm ? 1.67f : facility == Facility.MembranePlant ? 1.43f : .96f; + room.Solid(DeckTrim, x, .13f, z, radius * 2.05f, .26f, radius * 2.05f); + room.Cylinder(Alloy, x, .23f, z, height, radius); + room.Cylinder(accent, x, height + .23f, z, .12f, radius * .93f); + room.Cylinder(DeckTrim, x, height + .34f, z, .21f, .15f); + room.Box(accent, x, .69f, z - radius, .43f, .12f, .072f); + room.Rod(Alloy, new Vector3(x, height + .51f, z), new Vector3(x, 1.96f, z + .64f), .071f); + room.Rod(Joinery, new Vector3(x + radius, .32f, z), new Vector3(x + radius + .37f, .32f, z), .071f); + room.Cylinder(accent, x + radius + .29f, .29f, z, .17f, .13f); + } + + private static void FitColdRack(Venue room, float x, float z, int variety) + { + room.Solid(Alloy, x, 1.03f, z + .26f, 2.20f, 2.06f, .105f); + for (int shelf = 0; shelf < 4; shelf++) + { + float y = .25f + shelf * .477f; + room.Solid(DeckTrim, x, y, z, 2.26f, .065f, .65f); + room.Box(PoolTile, x, y + .04f, z - .33f, 2.20f, .022f, .019f); + for (int item = -1; item <= 1; item++) + { + float place = x + item * .61f; + int color = (item + variety + shelf + 1) % 3 == 0 ? PoolTile : Ivory; + room.Box(color, place, y + .166f, z, .49f, .258f, .44f); + room.Box(DeckTrim, place, y + .205f, z - .225f, .13f, .041f, .014f); + } + } + } + + private static void FitLaundryBank(Venue room, float x, float z) + { + for (int side = -1; side <= 1; side += 2) + { + float place = x + side * .49f; + room.Solid(Ivory, place, .56f, z, .93f, 1.12f, .80f); + Vector3 face = new(place, .56f, z - .42f); + room.Rod(Alloy, face, face + Vector3.back * .069f, .302f); + room.Rod(WindowGlass, face + Vector3.back * .07f, face + Vector3.back * .088f, .221f); + room.Box(DisplayDark, place, 1.021f, z - .412f, .34f, .082f, .029f); + room.Box(ScreenGreen, place, 1.021f, z - .431f, .19f, .029f, .018f); + } + room.Box(Alloy, x, 1.145f, z, 2.01f, .073f, .87f); + } + + private static void FitServiceBench(Venue room, float x, float z, int accent, bool galley) + { + room.Solid(Alloy, x, .48f, z, 2.28f, .96f, .83f); + room.Box(Ivory, x, .992f, z, 2.42f, .071f, .92f); + for (int item = -1; item <= 1; item++) + { + float place = x + item * .62f; + room.Box(DeckTrim, place, .66f, z - .425f, .49f, .28f, .029f); + room.Box(accent, place, .744f, z - .444f, .22f, .040f, .014f); + if (galley) + room.Cylinder(Gasket, place, 1.031f, z + .02f, .034f, .208f); + else + room.Box(accent, place, 1.074f, z + .08f, .39f, .11f, .29f); + } + if (galley) + { + room.Box(Alloy, x, 2.14f, z, 2.48f, .28f, .98f); + room.Box(DeckTrim, x, 2.052f, z - .492f, 2.21f, .055f, .014f); + room.Box(LightStrip, x, 1.992f, z - .21f, 2.14f, .031f, .085f); + } + } + + private static void FitEngineeringRack(Venue room, float x, float z, int bank) + { + room.Solid(DeckTrim, x, .81f, z, 1.78f, 1.62f, .72f); + for (int row = 0; row < 3; row++) + { + float y = .44f + row * .377f; + room.Box(Alloy, x, y, z - .369f, 1.64f, .131f, .046f); + for (int col = -2; col <= 2; col++) + room.Box((col + bank + row) % 4 == 0 ? ScreenAmber : ScreenGreen, x + col * .25f, + y, z - .40f, .061f, .043f, .029f); + } + } + + private static void FitPlanter(Venue room, float x, float z) + { + room.Solid(Marble, x, .19f, z, .54f, .38f, .54f); + room.Cylinder(Joinery, x, .379f, z, .34f, .042f); + for (int branch = 0; branch < 6; branch++) + { + float angle = branch * Mathf.PI / 3; + Vector3 leaf = new(x + Mathf.Cos(angle) * .30f, .84f + .11f * (branch % 3), z + Mathf.Sin(angle) * .30f); + room.Rod(branch % 2 == 0 ? SafetyGreen : ScreenGreen, new Vector3(x, .62f, z), leaf, .045f); + room.Rod(SafetyGreen, leaf, leaf + Vector3.up * .15f, .031f); + } + } + } +} diff --git a/Assets/BigShipTycoon/Runtime/MegaVenues.cs.meta b/Assets/BigShipTycoon/Runtime/MegaVenues.cs.meta new file mode 100644 index 0000000..e29c482 --- /dev/null +++ b/Assets/BigShipTycoon/Runtime/MegaVenues.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 922875c43b514e51a31a7de697642bf1 diff --git a/Assets/BigShipTycoon/Runtime/MegaVesselExterior.cs b/Assets/BigShipTycoon/Runtime/MegaVesselExterior.cs new file mode 100644 index 0000000..28c77d1 --- /dev/null +++ b/Assets/BigShipTycoon/Runtime/MegaVesselExterior.cs @@ -0,0 +1,373 @@ +using UnityEngine; + +namespace BigShipTycoon +{ + internal sealed partial class VesselExterior + { + private const int MegaDeckStations = 56; + + private void BuildMegaPassengerDeck(int deck) + { + bool sky = deck == ship.Decks.Count - 1; + float floor = DeckBase + deck * DeckSpacing; + float roof = floor + DeckSpacing; + var (span, halfWidth, offset) = MegaDeckGeometry.ForShip(ship, deck, ship.Decks.Count); + var center = new Vector2(offset, 0); + Vector2[] edge = Outline(span, halfWidth, offset, MegaDeckStations); + Paint fascia = deck is 2 or 6 || sky ? Paint.AtriumGlass : Paint.Black; + float wall = sky ? .88f : .86f; + + Coat(Paint.MegaHull).Loft(edge, center, false, new Vector3(.985f, floor, wall - .025f), + new Vector3(.996f, floor + .22f, wall), new Vector3(.996f, roof - .30f, wall)); + Coat(fascia).Loft(edge, center, false, new Vector3(.997f, roof - .36f, wall + .01f), + new Vector3(1.009f, roof - .25f, .997f)); + Coat(Paint.Pearl).Loft(edge, center, false, new Vector3(1.010f, roof - .23f, 1.002f), + new Vector3(1.007f, roof - .09f, 1.002f), new Vector3(.997f, roof - .04f, .993f)); + Coat(Paint.Teak).Loft(edge, center, true, new Vector3(.997f, roof - .04f, .993f), + new Vector3(.994f, roof, .992f)); + + if (sky || deck >= ship.Decks.Count - 2 || deck is 2 or 6) + BuildMegaGlassRail(edge, roof, sky); + else + Rails(edge, roof, roof + .78f, 3.3f); + + float bay = .79f * span / balconies; + for (int i = 0; i < balconies; i++) + { + float station = Mathf.Lerp(.072f, .862f, (i + .5f) / balconies); + int column = Mathf.Min(ship.Hull.Columns - 1, Mathf.FloorToInt(station * ship.Hull.Columns)); + bool gallery = deck is >= 3 and <= 5 && station is >= .41f and <= .57f; + bool band = deck is 2 or 6 || station > .72f || sky; + for (int side = -1; side <= 1; side += 2) + { + var (at, along, outward) = SideFrame(station, floor, span * .996f, halfWidth * wall, + offset, side, MegaDeckStations); + int row = side < 0 ? 0 : ship.Hull.Rows - 1; + Facility fitting = ship.Decks[deck].FacilityAt(row * ship.Hull.Columns + column, ship.Hull.Columns); + float balconyDepth = halfWidth * SideWidth(station) * (.992f - wall); + BuildMegaWindowBay(at, along, outward, side, bay, balconyDepth, fitting, i, deck, band, gallery); + } + } + + if (!sky) + return; + float stern = offset - span * .5f; + for (int side = -1; side <= 1; side += 2) + Coat(Paint.AtriumGlass).Loft(RoundedRectangle(new Vector2(stern + .84f, side * halfWidth * .34f), + 1.3f, 2.15f, .46f), new Vector2(stern + .84f, side * halfWidth * .34f), false, + new Vector3(.9f, floor + .21f, 1f), new Vector3(1f, roof - .16f, 1f)); + } + + private void BuildMegaWindowBay(Vector3 at, Vector3 along, Vector3 outward, int side, float bay, + float depth, Facility fitting, int index, int deck, bool band, bool gallery) + { + bool suite = fitting is Facility.Cabin or Facility.Suite or Facility.GrandSuite or Facility.SkyResidence; + bool machinery = fitting is Facility.Tank or Facility.Stores or Facility.Waste or Facility.Water + or Facility.Workshop or Facility.Galley or Facility.BunkerFarm or Facility.ColdChain or Facility.LaundryPlant + or Facility.MembranePlant or Facility.ReclamationPlant or Facility.EngineeringCenter or Facility.ProductionGalley; + if (machinery && !gallery) + { + if ((index & 1) == 0) + BuildVent(at + outward * .075f + Vector3.up * 1.44f, along, outward, side, bay * .60f); + return; + } + bool lit = fitting != Facility.Empty && (index * 13 + deck * 7 + side + 1) % 17 < 4; + Paint glazing = gallery || band ? Paint.AtriumGlass : Paint.Glass; + float width = bay * (gallery ? .965f : band ? .91f : .86f); + float height = gallery ? 1.95f : suite ? 1.86f : 1.51f; + Vector3 center = at + outward * .091f + Vector3.up * (gallery ? 1.28f : 1.23f); + SidePanel(Coat(Paint.Black), center, along, side, width, height); + int panes = gallery ? 2 : 3; + float pane = (width - .036f) / panes; + for (int ii = 0; ii < panes; ii++) + { + Vector3 glass = center + outward * .009f + along * ((ii + .5f - panes * .5f) * pane); + SidePanel(Coat(lit && ii == 0 ? Paint.Lounge : glazing), glass, along, side, pane - .031f, height - .10f); + } + + if (gallery && index % 3 == 0) + { + Vector3 stem = center + along * width * .50f + outward * .095f - Vector3.up * 1.25f; + Coat(Paint.Pearl).Rod(stem, stem + Vector3.up * DeckSpacing + along * .41f, .055f, 5); + } + if (suite || !band && !gallery) + { + // A flush glass front is backed by an actual recessed balcony and a dividing privacy screen. + Vector3 rail = at + outward * Mathf.Max(.90f, depth - .33f); + SidePanel(Coat(Paint.BlueGlass), rail + Vector3.up * .53f, along, side, width * .95f, .71f); + Coat(Paint.Steel).Rod(rail - along * width * .49f + Vector3.up * .93f, + rail + along * width * .49f + Vector3.up * .93f, .030f, 5); + Coat(Paint.Pearl).Box(at + along * (bay * .49f) + outward * (depth * .46f) + Vector3.up * .72f, + new Vector3(.044f, 1.31f, Mathf.Max(.43f, depth * .78f)), along); + } + } + + private void BuildMegaGlassRail(Vector2[] contour, float y, bool sky) + { + HarborMesh upper = Coat(Paint.Steel); + HarborMesh panes = Coat(Paint.AtriumGlass); + float halfBeam = MegaDeckGeometry.ForShip(ship, ship.Decks.Count - 1, ship.Decks.Count).Beam; + for (int segment = 0; segment < contour.Length; segment++) + { + Vector2 first = contour[segment]; + Vector2 end = contour[(segment + 1) % contour.Length]; + int spans = Mathf.Max(1, Mathf.CeilToInt(Vector2.Distance(first, end) / 2.8f)); + for (int span = 0; span < spans; span++) + { + Vector2 a = Vector2.Lerp(first, end, span / (float)spans); + Vector2 b = Vector2.Lerp(first, end, (span + 1f) / spans); + float midway = (a.y + b.y) * .5f; + if (sky && segment == contour.Length - 1 && Mathf.Abs(Mathf.Abs(midway) - halfBeam * .23f) < .90f) + continue; + Vector3 lowerA = HarborMesh.Point(a, y + .11f); + Vector3 lowerB = HarborMesh.Point(b, y + .11f); + Vector3 headA = HarborMesh.Point(a, y + .88f); + Vector3 headB = HarborMesh.Point(b, y + .88f); + Vector3 inset = (lowerB - lowerA).normalized * .041f; + panes.Quad(lowerA + inset, lowerB - inset, headB - inset, headA + inset); + panes.Quad(lowerB - inset, lowerA + inset, headA + inset, headB - inset); + upper.Rod(headA, headB, .039f, 5); + upper.Rod(lowerA - Vector3.up * .11f, headA, .033f, 5); + } + } + } + + private void BuildMegaRoof() + { + int count = ship.Decks.Count; + var (deckLength, halfWidth, offset) = MegaDeckGeometry.ForShip(ship, count - 1, count); + float top = MegaDeckGeometry.RoofHeight(count, SunDeckZone.Sky); + float bridge = MegaDeckGeometry.BridgeCenter(ship, count); + BuildMegaObservationBridge(bridge, halfWidth, top); + BuildMegaFunnelPavilion(offset - deckLength * .24f, halfWidth, top); + BuildMegaRoofTrack(deckLength, halfWidth, offset, top); + BuildMegaAftTerrace(count, top, halfWidth); + BuildSunDeck(SunDeck(ship), top); + BuildSunDeck(SunDeck(ship, SunDeckZone.AftTerrace), top - DeckSpacing); + } + + private void BuildMegaObservationBridge(float bridge, float halfWidth, float y) + { + Vector2 center = new Vector2(bridge, 0); + Vector2[] profile = Outline(19.1f, halfWidth * .62f, bridge, 28); + Coat(Paint.Pearl).Loft(profile, center, false, new Vector3(.94f, y, .90f), new Vector3(1f, y + .74f, 1f)); + Coat(Paint.AtriumGlass).Loft(profile, center, false, new Vector3(1f, y + .74f, 1f), + new Vector3(.984f, y + 2.57f, .93f)); + Coat(Paint.MegaHull).Loft(profile, center, true, new Vector3(.987f, y + 2.54f, .939f), + new Vector3(1.047f, y + 2.76f, 1.03f), new Vector3(.98f, y + 2.98f, .96f)); + Coat(Paint.FritGlass).Loft(profile, center, true, new Vector3(.77f, y + 2.98f, .79f), + new Vector3(.67f, y + 3.78f, .72f), new Vector3(.47f, y + 4.48f, .52f), + new Vector3(.25f, y + 4.86f, .34f)); + for (int edge = 0; edge < profile.Length; edge += 2) + { + Vector2 point = profile[edge] - center; + Coat(Paint.Pearl).Rod(HarborMesh.Point(center + point, y + .74f), + HarborMesh.Point(center + Vector2.Scale(point, new Vector2(.984f, .933f)), y + 2.57f), .052f, 5); + Vector3 spring = HarborMesh.Point(center + Vector2.Scale(point, new Vector2(.77f, .79f)), y + 2.99f); + Vector3 knee = HarborMesh.Point(center + Vector2.Scale(point, new Vector2(.67f, .72f)), y + 3.80f); + Vector3 shoulder = HarborMesh.Point(center + Vector2.Scale(point, new Vector2(.47f, .52f)), y + 4.50f); + Coat(Paint.Pearl).Rod(spring, knee, .045f, 5); + Coat(Paint.Pearl).Rod(knee, shoulder, .045f, 5); + } + for (int side = -1; side <= 1; side += 2) + { + Vector3 wing = new Vector3(bridge + 2.45f, y + 1.52f, side * halfWidth * .597f); + Coat(Paint.AtriumGlass).Box(wing, new Vector3(3.50f, 1.39f, 2.12f)); + Coat(Paint.Pearl).Box(wing + Vector3.up * .73f, new Vector3(3.65f, .14f, 2.26f)); + Coat(Paint.Pearl).Box(wing - Vector3.up * .76f, new Vector3(3.65f, .21f, 2.24f)); + Coat(side > 0 ? Paint.StarboardLight : Paint.PortLight).Box(wing + Vector3.forward * (side * 1.13f), + new Vector3(.26f, .14f, .055f)); + } + Vector3 mast = new Vector3(bridge + 2.18f, y + 4.79f, 0); + Coat(Paint.Pearl).Rod(mast, mast + new Vector3(-.21f, 1.03f, 0), .10f, 8); + Coat(Paint.Steel).Rod(mast + new Vector3(-.13f, .65f, -1.24f), + mast + new Vector3(-.13f, .65f, 1.24f), .039f, 6); + Coat(Paint.LitGlass).Radome(mast + new Vector3(-.21f, 1.05f, 0), .115f); + } + + private void BuildMegaFunnelPavilion(float x, float halfWidth, float y) + { + Vector2 center = new Vector2(x, 0); + Vector2[] baseOutline = RoundedRectangle(center, 8.5f, halfWidth * .51f, 2.12f); + Coat(Paint.Pearl).Loft(baseOutline, center, false, new Vector3(1f, y, 1f), + new Vector3(1f, y + .45f, 1f)); + Coat(Paint.AtriumGlass).Loft(baseOutline, center, false, new Vector3(.96f, y + .45f, .95f), + new Vector3(.96f, y + 1.35f, .95f)); + Coat(Paint.Pearl).Loft(baseOutline, center, true, new Vector3(.96f, y + 1.36f, .95f), + new Vector3(1f, y + 1.54f, 1f), new Vector3(.93f, y + 1.73f, .94f)); + + for (int side = -1; side <= 1; side += 2) + { + float z = side * halfWidth * .295f; + Vector2 stack = new Vector2(x - 1.45f, z); + Vector2[] blade = Outline(11.15f, 2.36f, stack.x, 20, z); + Coat(Paint.MegaHull).Loft(blade, stack, false, new Vector3(1f, y + 1.69f, 1f), + new Vector3(.97f, y + 2.52f, .92f), new Vector3(.81f, y + 4.59f, .77f)); + Coat(Paint.AtriumGlass).Loft(blade, stack, true, new Vector3(.813f, y + 4.54f, .774f), + new Vector3(.78f, y + 4.82f, .70f), new Vector3(.73f, y + 4.92f, .65f)); + for (int outlet = -1; outlet <= 1; outlet++) + { + Vector3 foot = new Vector3(stack.x - 1.9f + outlet * 1.33f, y + 4.88f, z); + Coat(Paint.Black).Rod(foot, foot + new Vector3(-.25f, .55f, 0), .31f, 12, true); + Coat(Paint.Steel).Rod(foot + new Vector3(-.24f, .49f, 0), foot + new Vector3(-.28f, .61f, 0), .34f, 12); + } + for (int louver = 0; louver < 11; louver++) + { + float lp = louver * .58f - 2.9f; + Vector3 b = new Vector3(stack.x + lp, y + 2.03f, z + side * 2.09f); + Vector3 t = b + new Vector3(-.43f, 1.82f, -side * .38f); + Coat(Paint.Steel).Rod(b, t, .037f, 5); + } + Vector3 antenna = new Vector3(x + 5.78f, y + 1.71f, side * halfWidth * .36f); + Coat(Paint.Steel).Rod(antenna, antenna + Vector3.up * .73f, .12f, 8); + Coat(Paint.Pearl).Radome(antenna + Vector3.up * 1.10f, .72f); + } + } + + private void BuildMegaRoofTrack(float span, float halfWidth, float center, float y) + { + HarborMesh track = Coat(Paint.DeckTrack); + HarborMesh lines = Coat(Paint.Pearl); + for (int side = -1; side <= 1; side += 2) + for (int segment = 0; segment < 54; segment++) + { + float a = Mathf.Lerp(.065f, .84f, segment / 54f); + float b = Mathf.Lerp(.065f, .84f, (segment + 1f) / 54f); + float ax = center + (a - .5f) * span * .994f; + float bx = center + (b - .5f) * span * .994f; + float az = side * (SideWidth(a) * halfWidth * .992f - .37f); + float bz = side * (SideWidth(b) * halfWidth * .992f - .37f); + var left = new Vector3(ax, y + .013f, az); + var right = new Vector3(bx, y + .013f, bz); + Vector3 inset = Vector3.forward * (-side * .52f); + if (side < 0) + track.Quad(left + inset, right + inset, right, left); + else + track.Quad(left, right, right + inset, left + inset); + if (segment % 3 != 1) + lines.Rod(left + inset * .55f + Vector3.up * .009f, + right + inset * .55f + Vector3.up * .009f, .018f, 4); + } + } + + private void BuildMegaAftTerrace(int count, float top, float skyWidth) + { + float floor = top - DeckSpacing; + Rect venueSpace = MegaDeckGeometry.TerraceArea(length, beam, count); + for (int side = -1; side <= 1; side += 2) + { + float z = side * skyWidth * .23f; + const int stepCount = 15; + float stairSpan = .015f * length; + for (int step = 0; step < stepCount; step++) + { + float rise = DeckSpacing * (step + 1f) / stepCount; + float x = -.230f * length + stairSpan * (step + .5f) / stepCount; + Coat(Paint.Pearl).Box(new Vector3(x, floor + rise * .5f, z), + new Vector3(stairSpan / stepCount + .02f, rise, 1.47f)); + Coat(Paint.Teak).Box(new Vector3(x, floor + rise + .006f, z), + new Vector3(stairSpan / stepCount, .012f, 1.34f)); + } + Coat(Paint.Teak).Box(new Vector3(-.215f * length + .32f, top - .02f, z), new Vector3(.74f, .065f, 1.48f)); + for (int rail = -1; rail <= 1; rail += 2) + { + Vector3 foot = new Vector3(-.230f * length, floor, z + rail * .70f); + Vector3 head = new Vector3(-.215f * length, top, foot.z); + Coat(Paint.Steel).Rod(foot + Vector3.up * .86f, head + Vector3.up * .89f, .041f, 6); + for (int brace = 0; brace <= 4; brace++) + { + Vector3 post = Vector3.Lerp(foot, head, brace / 4f); + Coat(Paint.Steel).Rod(post, post + Vector3.up * .86f, .026f, 5); + } + } + + float border = side * (venueSpace.height * .5f + 1.62f); + for (int bay = 0; bay < 4; bay++) + { + float x = Mathf.Lerp(venueSpace.xMin + 4.5f, venueSpace.xMax - 6.4f, bay / 3f); + Vector3 planter = new Vector3(x, floor, border); + BuildMegaPlanter(planter, bay); + if ((bay & 1) == 0) + BuildParasol(planter + new Vector3(2.6f, 0, .38f * side), side > 0); + } + } + } + + private void BuildMegaPlanter(Vector3 foot, int variant) + { + Coat(Paint.MegaHull).Box(foot + Vector3.up * .26f, new Vector3(2.52f, .52f, .88f)); + Coat(Paint.Teak).Box(foot + Vector3.up * .52f, new Vector3(2.60f, .046f, .95f)); + for (int plant = -1; plant <= 1; plant++) + { + Vector3 stem = foot + new Vector3(plant * .72f, .61f, 0); + float scale = .29f + .039f * ((variant + plant + 3) % 4); + Coat(Paint.Fringe).Radome(stem + Vector3.up * .21f, scale); + Coat(Paint.Turf).Radome(stem + new Vector3(.10f, .36f, -.05f), .72f * scale); + } + } + + private void BuildMegaHullDetail() + { + for (int side = -1; side <= 1; side += 2) + { + for (int i = 0; i < 11; i++) + { + float station = Mathf.Lerp(.123f, .83f, i / 10f); + var (at, along, outward) = SideFrame(station, 3.66f, length * 1.005f, beam * 1.0183f, + 0, side, ExteriorHullStations); + SidePanel(Coat(Paint.AtriumGlass), at + outward * .055f, along, side, 1.16f, .20f); + } + for (int i = 0; i < 3; i++) + { + var (opening, along, outward) = SideFrame(.237f + i * .195f, 3.92f, length * 1.006f, beam * 1.022f, + 0, side, ExteriorHullStations); + SidePanel(Coat(Paint.Steel), opening + outward * .069f, along, side, 5.91f, .70f); + SidePanel(Coat(Paint.Black), opening + outward * .083f, along, side, 5.78f, .57f); + for (int pane = -2; pane <= 2; pane++) + SidePanel(Coat(Paint.AtriumGlass), opening + outward * .092f + along * (pane * 1.133f), + along, side, 1.104f, .53f); + } + } + + float bow = length * .475f; + var center = new Vector2(bow, 0); + Vector2[] bulb = Outline(16.3f, beam * .118f, bow, 24); + Coat(Paint.Antifouling).Loft(bulb, center, true, new Vector3(.61f, -2.48f, .56f), + new Vector3(1f, -1.91f, 1f), new Vector3(.93f, -1.31f, .93f), new Vector3(.59f, -.88f, .65f)); + } + + private void BuildMegaLifeboats() + { + const int count = 12; + for (int side = -1; side <= 1; side += 2) + for (int index = 0; index < count; index++) + { + float station = Mathf.Lerp(.168f, .704f, index / (count - 1f)); + var (at, _, _) = SideFrame(station, 7.88f, length, beam, 0, side, ExteriorHullStations); + float x = at.x; + float z = at.z + side * .19f; + var center = new Vector2(x, z); + Vector2[] body = Outline(8.9f, 1.40f, x, 20, z); + Coat(Paint.Pearl).Loft(body, center, false, new Vector3(.89f, 7.16f, .55f), + new Vector3(1f, 7.53f, 1f), new Vector3(1f, 7.75f, 1f)); + Coat(Paint.Lifeboat).Loft(body, center, true, new Vector3(1f, 7.75f, 1f), + new Vector3(.92f, 8.18f, .89f), new Vector3(.77f, 8.57f, .76f)); + for (int window = 0; window < 5; window++) + { + var (pane, along, outward) = SideFrame(.27f + .115f * window, 8.32f, 7.79f, 1.17f, x, side, 20); + SidePanel(Coat(Paint.Black), pane + new Vector3(0, 0, z) + outward * .028f, + along, side, .60f, .22f); + } + for (int davit = -1; davit <= 1; davit += 2) + { + var foot = new Vector3(x + davit * 3.14f, 6.82f, z - side * 1.77f); + var elbow = foot + new Vector3(0, 2.86f, side * .63f); + var hook = elbow + new Vector3(0, -.14f, side * 1.38f); + Coat(Paint.Pearl).Rod(foot, elbow, .147f, 8, true); + Coat(Paint.Pearl).Rod(elbow, hook, .123f, 8, true); + Coat(Paint.Steel).Rod(hook, new Vector3(hook.x, 8.45f, hook.z), .040f, 6, true); + } + } + } + } +} diff --git a/Assets/BigShipTycoon/Runtime/MegaVesselExterior.cs.meta b/Assets/BigShipTycoon/Runtime/MegaVesselExterior.cs.meta new file mode 100644 index 0000000..c8b2906 --- /dev/null +++ b/Assets/BigShipTycoon/Runtime/MegaVesselExterior.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 99b9d6fcc5824f10a3a30a2de7e14efa diff --git a/Assets/BigShipTycoon/Runtime/OnboardEconomy.cs b/Assets/BigShipTycoon/Runtime/OnboardEconomy.cs index 44074dd..3a999ea 100644 --- a/Assets/BigShipTycoon/Runtime/OnboardEconomy.cs +++ b/Assets/BigShipTycoon/Runtime/OnboardEconomy.cs @@ -96,9 +96,10 @@ namespace BigShipTycoon capacity[0] = ship.Beds; capacity[1] = ship.Meals; capacity[2] = ship.BarCapacity; - capacity[3] = ship.Entertainment - (quote.Weather == WeatherCondition.Storm ? ship.SunDeckPlan.AddedShows : 0); - int outdoor = ship.PoolCapacity; - capacity[4] = quote.Weather switch { WeatherCondition.Storm => 0, WeatherCondition.Swell => outdoor * 2 / 3, _ => outdoor }; + capacity[3] = ship.Entertainment - (quote.Weather == WeatherCondition.Storm ? ship.OutdoorShowCapacity : 0); + int indoor = ship.Count(Facility.ThermalSpa) * Market.Facilities[(int)Facility.ThermalSpa].Capacity; + int outdoor = ship.PoolCapacity - indoor; + capacity[4] = indoor + (quote.Weather switch { WeatherCondition.Storm => 0, WeatherCondition.Swell => outdoor * 2 / 3, _ => outdoor }); capacity[(int)OnboardService.Retail] = ship.RetailCapacity; capacity[(int)OnboardService.Casino] = ship.CasinoCapacity; diff --git a/Assets/BigShipTycoon/Runtime/OnboardRounds.cs b/Assets/BigShipTycoon/Runtime/OnboardRounds.cs index 53463d3..733577a 100644 --- a/Assets/BigShipTycoon/Runtime/OnboardRounds.cs +++ b/Assets/BigShipTycoon/Runtime/OnboardRounds.cs @@ -77,7 +77,7 @@ namespace BigShipTycoon StationKind.Retail when DiscountTicks(OnboardService.Retail) > 0 => "A shop sale is already underway", StationKind.Retail when GetPrice(OnboardService.Retail) == 0 || capacity[(int)OnboardService.Retail] == 0 => "Set a shopping price to run a sale", StationKind.Stage when capacity[(int)OnboardService.Shows] == 0 => "No show lounge is fitted", - StationKind.Pool when Quote.Weather == WeatherCondition.Storm => "The terrace is closed in this weather", + StationKind.Pool when Quote.Weather == WeatherCondition.Storm && Ship.Count(Facility.ThermalSpa) == 0 => "The terrace is closed in this weather", StationKind.Pool when WaterPercent < 22 => "Freshwater is too low for pool operation", StationKind.Laundry when AssignedCrew(CrewRole.Laundry) == 0 => "No laundry crew is assigned", StationKind.Laundry when LaundryBoost => "The extra shift is already running", diff --git a/Assets/BigShipTycoon/Runtime/OnboardSystems.cs b/Assets/BigShipTycoon/Runtime/OnboardSystems.cs index e016fab..7257f74 100644 --- a/Assets/BigShipTycoon/Runtime/OnboardSystems.cs +++ b/Assets/BigShipTycoon/Runtime/OnboardSystems.cs @@ -28,7 +28,7 @@ namespace BigShipTycoon public bool TreatmentBoost => treatmentUntil > tick; public bool LaundryBoost => laundryUntil > tick; public int LaundryDemand { get; private set; } - public int LaundryCapacity => Math.Min(138 + Ship.HullIndex * 140, AssignedCrew(CrewRole.Laundry) * 22) + public int LaundryCapacity => Math.Min(138 + Ship.HullIndex * 140 + Ship.FittedLaundryCapacity, AssignedCrew(CrewRole.Laundry) * 22) + (LaundryBoost ? Math.Min(58, AssignedCrew(CrewRole.Laundry) * 9) : 0); public int LaundryBacklog => (int)Math.Ceiling(laundryBacklog); public int LaundryCleaned => (int)Math.Floor(laundryCleaned); @@ -103,7 +103,8 @@ namespace BigShipTycoon if (RepairCredit > 0 || Ship.Condition >= 100 || !CanSpend(RepairCost)) return; Expenses += RepairCost; - RepairCredit = Math.Min(6, 2 + Ship.Count(Facility.Workshop) * Market.Facilities[(int)Facility.Workshop].Capacity); + int maximum = Ship.HullIndex == Market.Mega ? 12 : 6; + RepairCredit = Math.Min(maximum, 2 + Ship.FittedRepairCapacity); } private void InitializeSystems() diff --git a/Assets/BigShipTycoon/Runtime/PassageInterface.cs b/Assets/BigShipTycoon/Runtime/PassageInterface.cs index 2be5b51..42c55a0 100644 --- a/Assets/BigShipTycoon/Runtime/PassageInterface.cs +++ b/Assets/BigShipTycoon/Runtime/PassageInterface.cs @@ -55,6 +55,8 @@ namespace BigShipTycoon passageEventHost = Add(overlay, "voyage-event-host"); passageEventHost.pickingMode = PickingMode.Ignore; + bool mega = Ship.HasAftTerrace; + passageEventHost.EnableInClassList("voyage-event-host-mega", mega); passageEventTitle = null; passageEventClock = null; passageEventAccept = null; @@ -62,10 +64,23 @@ namespace BigShipTycoon var decks = Add(overlay, "voyage-deck-stack"); decks.pickingMode = PickingMode.Ignore; + decks.EnableInClassList("voyage-deck-stack-mega", mega); AddText(decks, "DECK VIEW", "voyage-caption voyage-deck-caption"); AddPassageDeckButton(decks, -1, "Exterior", "passage-deck-all"); + VisualElement levels = decks; + if (mega) + { + var zones = Add(decks, "voyage-deck-zone-row"); + zones.pickingMode = PickingMode.Ignore; + zones.Add(Action("Sky deck", () => ViewPassageSunDeck(SunDeckZone.Sky), + PassageViewClass(passageSunZone == SunDeckZone.Sky), "passage-sky-deck")); + zones.Add(Action("Aft terrace", () => ViewPassageSunDeck(SunDeckZone.AftTerrace), + PassageViewClass(passageSunZone == SunDeckZone.AftTerrace), "passage-aft-terrace")); + levels = Add(decks, "voyage-deck-grid"); + levels.pickingMode = PickingMode.Ignore; + } for (int i = Ship.Decks.Count - 1; i >= 0; i--) - AddPassageDeckButton(decks, i, $"Deck {i + 1}", $"passage-deck-{i}"); + AddPassageDeckButton(levels, i, $"Deck {i + 1}", $"passage-deck-{i}"); var footer = Add(overlay, "voyage-footer"); footer.pickingMode = PickingMode.Ignore; @@ -86,6 +101,8 @@ namespace BigShipTycoon ExploreServiceArea(passageServiceArea); else if (passageExploring) ExplorePassageDeck(); + else if (passageSunZone.HasValue) + ViewPassageSunDeck(passageSunZone.Value); else harbor.ResetView(); }, "voyage-view-button voyage-reset", "passage-camera-reset")); @@ -193,7 +210,7 @@ namespace BigShipTycoon private void AddPassageDeckButton(VisualElement controls, int deck, string text, string id) { - bool active = deck == passageDeck && !passageBridge && !passageExploring && passageServiceArea < 0; + bool active = deck == passageDeck && !passageSunZone.HasValue && !passageBridge && !passageExploring && passageServiceArea < 0; controls.Add(Action(text, () => SelectPassageDeck(deck), PassageViewClass(active), id)); } diff --git a/Assets/BigShipTycoon/Runtime/ServiceDeckModel.cs b/Assets/BigShipTycoon/Runtime/ServiceDeckModel.cs index 46db750..7ebb35d 100644 --- a/Assets/BigShipTycoon/Runtime/ServiceDeckModel.cs +++ b/Assets/BigShipTycoon/Runtime/ServiceDeckModel.cs @@ -56,7 +56,8 @@ namespace BigShipTycoon { material.SetFloat("_BayLength", bayLength); material.SetFloat("_RoomLight", Mathf.Lerp(CorridorHalfWidth, halfWidth, .55f)); - material.SetFloat("_DeckTread", pair.Key is Floor or RoomFloor or Grating ? 1 : 0); + material.SetFloat("_DeckTread", pair.Key == Grating ? 2 : pair.Key is Floor or RoomFloor ? 1 : 0); + material.SetFloat("_BulkheadLining", pair.Key is Wall or WallBase or Ceiling ? 1 : 0); } game.GetComponent().sharedMesh = mesh; game.GetComponent().sharedMaterial = material; diff --git a/Assets/BigShipTycoon/Runtime/StationInteractions.cs b/Assets/BigShipTycoon/Runtime/StationInteractions.cs index 4989a9a..e0750c5 100644 --- a/Assets/BigShipTycoon/Runtime/StationInteractions.cs +++ b/Assets/BigShipTycoon/Runtime/StationInteractions.cs @@ -66,7 +66,7 @@ namespace BigShipTycoon bool worked = livePassage.TryWorkStation(station, out string result); if (worked) AnnounceStation(station); - if (worked && (station is >= StationKind.Engine and <= StationKind.Waste or StationKind.Laundry)) + if (worked && passageServiceArea >= 0 && (station is >= StationKind.Engine and <= StationKind.Waste or StationKind.Laundry)) { int area = station == StationKind.Laundry ? 6 : (int)station - (int)StationKind.Engine; if (area != passageServiceArea) @@ -109,6 +109,11 @@ namespace BigShipTycoon private string StationDeck(StationKind station) { + if (Ship.HasAftTerrace) + for (int i = 0; i < Ship.Decks.Count; i++) + foreach (Facility cell in Ship.Decks[i].Cells) + if (DeckPassengers.FacilityStation(cell) == station) + return $"Deck {i + 1}"; if (station <= StationKind.Waste || station == StationKind.Laundry) return "Service deck"; diff --git a/Assets/BigShipTycoon/Runtime/SunDeckAttractions.cs b/Assets/BigShipTycoon/Runtime/SunDeckAttractions.cs index fe99722..bdad534 100644 --- a/Assets/BigShipTycoon/Runtime/SunDeckAttractions.cs +++ b/Assets/BigShipTycoon/Runtime/SunDeckAttractions.cs @@ -13,9 +13,51 @@ namespace BigShipTycoon case SunAttraction.MiniGolf: BuildPuttingGreens(venue, top); break; case SunAttraction.GoKarts: BuildKartCircuit(venue, top); break; case SunAttraction.RollerCoaster: BuildCoaster(venue, top); break; + case SunAttraction.SkyGarden: BuildSkyGarden(venue, top); break; } } + private void BuildSkyGarden(SunDeckVenue venue, float top) + { + Vector2 half = venue.HalfSize; + var floor = new Vector3(0, top + .055f, 0); + Coat(Paint.TeakSeam).Box(floor, new Vector3(half.x * 1.94f, .11f, half.y * 1.91f)); + PoolBasin(Coat(Paint.Pearl), Coat(Paint.BlueGlass), Coat(Paint.Pool), floor + Vector3.up * .01f, + new Vector2(2.8f, .77f), .27f, .17f, true); + + for (int side = -1; side <= 1; side += 2) + { + float pathEdge = side * half.y * .70f; + for (int group = -1; group <= 1; group++) + { + float x = group * half.x * .55f; + var basePoint = new Vector3(x, top + .22f, pathEdge); + Coat(Paint.Ivory).Box(basePoint, new Vector3(2.35f, .44f, 1.39f)); + Coat(Paint.Turf).Box(basePoint + Vector3.up * .225f, new Vector3(2.15f, .04f, 1.21f)); + for (int tree = -1; tree <= 1; tree += 2) + { + var stem = basePoint + new Vector3(tree * .51f, .23f, -.08f * side); + float height = 1.07f + .14f * (tree == side ? 1 : 0); + Coat(Paint.TeakSeam).Rod(stem, stem + Vector3.up * height, .072f, 7); + Coat(Paint.Fringe).Radome(stem + Vector3.up * (height + .11f), .57f); + Coat(Paint.Turf).Radome(stem + new Vector3(.25f * side, height + .44f, .12f), .34f); + } + } + + for (int end = -1; end <= 1; end += 2) + { + float x = end * half.x * .67f; + var foot = new Vector3(x, top, side * half.y * .35f); + Coat(Paint.Steel).Rod(foot, foot + Vector3.up * 2.67f, .065f, 8); + Coat(Paint.Teak).Box(foot + new Vector3(-end * .5f, .46f, -side * .40f), new Vector3(1.75f, .18f, .58f)); + } + } + for (int step = -9; step <= 9; step++) + Coat(Paint.Pearl).Box(new Vector3(step * .64f, top + 2.68f, 0), new Vector3(.22f, .12f, half.y * .75f)); + for (int side = -1; side <= 1; side += 2) + Coat(Paint.Steel).Box(new Vector3(0, top + 2.56f, side * half.y * .35f), new Vector3(half.x * 1.4f, .12f, .12f)); + } + private void BuildPuttingGreens(SunDeckVenue venue, float top) { Vector2 half = venue.PuttingHalfSize; @@ -171,8 +213,13 @@ namespace BigShipTycoon internal readonly SunDeckVenue Venue; internal readonly Transform[] Vehicles = new Transform[3]; internal float Phase; + internal readonly float DeckHeight; - internal SunDeckRide(SunDeckVenue venue) => Venue = venue; + internal SunDeckRide(SunDeckVenue venue, float deckHeight) + { + Venue = venue; + DeckHeight = deckHeight; + } } internal float SunRidePhase(SunAttraction kind) @@ -185,6 +232,17 @@ namespace BigShipTycoon private void AddSunAttractionGuests(Layout layout, SunDeckVenue venue, float height) { + if (venue.Kind == SunAttraction.SkyGarden) + { + for (int side = -1; side <= 1; side += 2) + { + AddSunGuest(layout, venue, GuestActivity.Photograph, new Vector3(3.6f * side, height, .5f * side), + 193 + side, side * 92, (int)OnboardService.Amenities, .32f); + AddSunGuest(layout, venue, GuestActivity.Talk, new Vector3(-1.7f * side, height, 2.1f * side), + 287 + side, side * 80, (int)OnboardService.Amenities, .52f); + } + return; + } if (venue.Kind == SunAttraction.MiniGolf) { Vector2 half = venue.PuttingHalfSize; @@ -203,7 +261,7 @@ namespace BigShipTycoon return; bool coaster = venue.Kind == SunAttraction.RollerCoaster; - var ride = new SunDeckRide(venue); + var ride = new SunDeckRide(venue, height - .015f); sunDeckRides.Add(ride); Transform track = Piece(coaster ? "Roller coaster train" : "Kart circuit traffic", layout.Room.transform).transform; track.SetLocalPositionAndRotation(venue.Position(Vector3.zero), venue.Orientation); @@ -213,7 +271,7 @@ namespace BigShipTycoon ride.Vehicles[i] = car.transform; FitRideVehicle(car.transform, coaster, i); } - PositionRideVehicles(ride, height - .015f); + PositionRideVehicles(ride); Vector3 queue = new(-venue.HalfSize.x * .67f, height, venue.HalfSize.y * .91f); for (int i = 0; i < 3; i++) @@ -256,12 +314,13 @@ namespace BigShipTycoon { float pace = ride.Venue.Kind == SunAttraction.RollerCoaster ? .145f : .112f; ride.Phase = Mathf.Repeat(ride.Phase + Mathf.Max(0, delta) * pace, 1); - PositionRideVehicles(ride, BridgeHeight); + PositionRideVehicles(ride); } } - private static void PositionRideVehicles(SunDeckRide ride, float top) + private static void PositionRideVehicles(SunDeckRide ride) { + float top = ride.DeckHeight; float spacing = ride.Venue.Kind == SunAttraction.RollerCoaster ? .028f : .31f; for (int i = 0; i < ride.Vehicles.Length; i++) { diff --git a/Assets/BigShipTycoon/Runtime/SunDeckEditor.cs b/Assets/BigShipTycoon/Runtime/SunDeckEditor.cs index a1ea240..2bb42f8 100644 --- a/Assets/BigShipTycoon/Runtime/SunDeckEditor.cs +++ b/Assets/BigShipTycoon/Runtime/SunDeckEditor.cs @@ -7,6 +7,7 @@ namespace BigShipTycoon { private bool sunDeckEditing, sunMoving; private Ship sunPlanningShip; + private SunDeckZone sunZone; private SunAttraction sunTool; private int sunRotation, sunSelection = -1; private System.Action refreshSunPlacement; @@ -14,14 +15,14 @@ namespace BigShipTycoon private static readonly (SunPoolStyle Style, string Label, string Id)[] SunPools = { (SunPoolStyle.Compact, "Compact", "compact"), (SunPoolStyle.Family, "Family", "family"), - (SunPoolStyle.Resort, "Resort", "resort") + (SunPoolStyle.Resort, "Resort", "resort"), (SunPoolStyle.Lagoon, "Lagoon", "lagoon") }; private static readonly (SunAttraction Kind, string Label, string Id)[] SunAttractions = { (SunAttraction.Pool, "Pool", "pool"), (SunAttraction.MiniGolf, "Mini golf", "golf"), (SunAttraction.Theater, "Outdoor theater", "theater"), (SunAttraction.GoKarts, "Go-karts", "karts"), - (SunAttraction.RollerCoaster, "Roller coaster", "coaster") + (SunAttraction.RollerCoaster, "Roller coaster", "coaster"), (SunAttraction.SkyGarden, "Sky garden", "garden") }; private void DrawSunDeckEditor(VisualElement work, Ship ship) @@ -29,29 +30,42 @@ namespace BigShipTycoon if (sunPlanningShip != ship) { sunPlanningShip = ship; + sunZone = SunDeckZone.Sky; ResetSunTool(); } - var grid = new SunDeckGrid(ship); - SunDeckPlan plan = ship.SunDeckPlan; + var grid = new SunDeckGrid(ship, zone: sunZone); + SunDeckPlan plan = ship.SunDeckFor(sunZone); SunPoolStyle pool = grid.SelectedPool; if (sunSelection >= grid.Existing.Count) ResetSunTool(); var board = Add(work, "work-draft"); - board.generateVisualContent += context => DrawDeckOutline(context, ship.Hull.Columns); + bool terrace = sunZone == SunDeckZone.AftTerrace; + board.generateVisualContent += context => + { + if (terrace) + DrawDraftGrid(context.painter2D, context.visualElement.contentRect, 26); + else + DrawDeckOutline(context, ship.Hull.Columns); + }; var markings = Add(board, "work-draft-markings"); markings.pickingMode = PickingMode.Ignore; AddText(markings, "STERN", "work-caption"); - AddText(markings, "SUN DECK", "work-caption"); - AddText(markings, "BOW →", "work-caption"); - var diagram = Add(board, "sun-deck-diagram"); + AddText(markings, terrace ? "AFT TERRACE" : ship.HasAftTerrace ? "SKY DECK" : "SUN DECK", "work-caption"); + AddText(markings, terrace ? "STAIRS TO SKY DECK →" : "BOW →", "work-caption"); + var diagram = Add(board, terrace ? "sun-deck-diagram sun-terrace-diagram" : "sun-deck-diagram"); var status = AddText(Add(board, "work-placement"), "", "work-placement-text"); status.name = "sun-placement-status"; refreshSunPlacement = DrawSunGrid(diagram, status, ship, grid, pool); var fittings = Add(work, "work-fittings sun-deck-panel"); var capacity = Add(fittings, "work-capacity-strip"); + if (ship.HasAftTerrace) + { + AddSunZone(capacity, SunDeckZone.Sky, "Sky deck", "sun-zone-sky"); + AddSunZone(capacity, SunDeckZone.AftTerrace, "Aft terrace", "sun-zone-terrace"); + } AddText(capacity, $"{ship.PoolCapacity:N0} amenity admissions", "work-capacity"); AddText(capacity, $"{ship.Entertainment:N0} show seats", "work-capacity"); @@ -59,10 +73,12 @@ namespace BigShipTycoon int existingPool = grid.PoolIndex; foreach (var option in SunAttractions) { + if (option.Kind == SunAttraction.SkyGarden && !ship.HasAftTerrace) + continue; bool isPool = option.Kind == SunAttraction.Pool; int minimumHull = SunDeckPlan.RequiredHull(option.Kind); string requirement = ship.HullIndex < minimumHull ? $"Requires a {Market.Hulls[minimumHull].Name} hull" : null; - int cost = isPool && existingPool >= 0 ? 0 : Company.SunDeckPlacementPrice(ship, new SunDeckPlacement(option.Kind, 0, 0)); + int cost = isPool && existingPool >= 0 ? 0 : Company.SunDeckPlacementPrice(ship, new SunDeckPlacement(option.Kind, 0, 0), zone: sunZone); string detail = requirement != null ? $" · {Market.Hulls[minimumHull].Name}" : cost > 0 ? $" {Money(cost)}" : ""; Button choose = Action(option.Label + detail, () => { @@ -117,7 +133,7 @@ namespace BigShipTycoon actions.Add(move); Button remove = Action("Remove", () => { - string failure = company.RemoveSunDeck(ship, sunSelection); + string failure = company.RemoveSunDeck(ship, sunSelection, sunZone); if (failure == null) ResetSunTool(); Apply(failure, "Sun deck fitting removed."); @@ -128,10 +144,12 @@ namespace BigShipTycoon var trim = SunDeckOptions(fittings, "Pool"); foreach (var option in SunPools) { + if (option.Style == SunPoolStyle.Lagoon && !ship.HasAftTerrace) + continue; var next = plan; next.Pool = option.Style; AddSunOption(trim, ship, next, option.Label, "sun-pool-" + option.Id, pool == option.Style, - option.Style == SunPoolStyle.Resort ? Market.Regional : 0); + SunDeckPlan.RequiredHull(option.Style)); } var rectangle = plan; rectangle.Shape = SunPoolShape.Rectangle; @@ -172,8 +190,11 @@ namespace BigShipTycoon diagram.Add(cell); } - AddSunDiagramFit(diagram, grid.Area, grid.Funnels, "Funnels", "sun-diagram-fixed"); - AddSunDiagramFit(diagram, grid.Area, grid.Bridge, "Bridge", "sun-diagram-fixed"); + if (sunZone == SunDeckZone.Sky) + { + AddSunDiagramFit(diagram, grid.Area, grid.Funnels, "Funnels", "sun-diagram-fixed"); + AddSunDiagramFit(diagram, grid.Area, grid.Bridge, "Bridge", "sun-diagram-fixed"); + } for (int i = 0; i < grid.Existing.Count; i++) { var placed = grid.Existing[i]; @@ -181,7 +202,7 @@ namespace BigShipTycoon string classes = placed.Kind switch { SunAttraction.Pool => "sun-diagram-pool", - SunAttraction.MiniGolf => "sun-diagram-golf", + SunAttraction.MiniGolf or SunAttraction.SkyGarden => "sun-diagram-golf", SunAttraction.Theater => "sun-diagram-theater", _ => "sun-diagram-ride" }; @@ -193,7 +214,7 @@ namespace BigShipTycoon { var water = new VisualElement { pickingMode = PickingMode.Ignore }; water.AddToClassList("sun-diagram-basin"); - water.EnableInClassList("sun-diagram-oval", ship.SunDeckPlan.Shape == SunPoolShape.Oval); + water.EnableInClassList("sun-diagram-oval", ship.SunDeckFor(sunZone).Shape == SunPoolShape.Oval); water.EnableInClassList("sun-diagram-turned", (placed.Rotation & 1) != 0); fitting.Insert(0, water); } @@ -211,7 +232,7 @@ namespace BigShipTycoon if (show) { var fitting = new SunDeckPlacement(sunTool, cursor.x, cursor.y, sunRotation); - string block = company.SunDeckPlacementBlock(ship, fitting, sunMoving ? sunSelection : -1); + string block = company.SunDeckPlacementBlock(ship, fitting, sunMoving ? sunSelection : -1, sunZone); preview.EnableInClassList("sun-diagram-invalid", block != null); PositionSunFit(preview, grid.Area, grid.Bounds(fitting, pool)); status.text = block ?? $"{(sunMoving ? "Move" : "Place")} {SunFittingName(sunTool)} {SunDirection(sunRotation)}"; @@ -243,12 +264,12 @@ namespace BigShipTycoon } var next = new SunDeckPlacement(sunTool, cell.x, cell.y, sunRotation); - string failure = company.PlaceSunDeck(ship, next, sunMoving ? sunSelection : -1); + string failure = company.PlaceSunDeck(ship, next, sunMoving ? sunSelection : -1, sunZone); string feedback = $"{SunFittingName(sunTool)} {(sunMoving ? "moved" : "fitted")}."; if (failure == null) { ResetSunTool(); - var updated = new SunDeckGrid(ship); + var updated = new SunDeckGrid(ship, zone: sunZone); sunSelection = updated.At(cell.x, cell.y, updated.SelectedPool); } Apply(failure, feedback); @@ -266,10 +287,10 @@ namespace BigShipTycoon } if (sunSelection < 0) return; - var grid = new SunDeckGrid(Ship); + var grid = new SunDeckGrid(Ship, zone: sunZone); var next = grid.Existing[sunSelection]; next.Rotation = (next.Rotation + 1) & 3; - Apply(company.PlaceSunDeck(Ship, next, sunSelection), $"{SunFittingName(next.Kind)} rotated."); + Apply(company.PlaceSunDeck(Ship, next, sunSelection, sunZone), $"{SunFittingName(next.Kind)} rotated."); } private void ResetSunTool() @@ -297,14 +318,27 @@ namespace BigShipTycoon return row; } + private void AddSunZone(VisualElement parent, SunDeckZone zone, string label, string id) + { + Button button = Action(label, () => + { + sunZone = zone; + ResetSunTool(); + Notify(null); + Render(); + }, "sun-deck-choice", id); + button.EnableInClassList("sun-deck-selected", sunZone == zone); + parent.Add(button); + } + private void AddSunOption(VisualElement row, Ship ship, SunDeckPlan next, string label, string id, bool selected, int minimumHull = 0) { next.CustomLayout = true; string requirement = ship.HullIndex < minimumHull ? $"Requires a {Market.Hulls[minimumHull].Name} hull" : null; - int cost = Company.SunDeckCost(ship, next); + int cost = Company.SunDeckCost(ship, next, sunZone); string detail = requirement == null && cost > 0 ? $" {Money(cost)}" : ""; - Button option = Action(label + detail, () => Apply(company.ChangeSunDeck(ship, next), "Sun deck refitted."), "sun-deck-choice", id); + Button option = Action(label + detail, () => Apply(company.ChangeSunDeck(ship, next, sunZone), "Sun deck refitted."), "sun-deck-choice", id); option.EnableInClassList("sun-deck-selected", selected); option.SetEnabled(requirement == null && company.AvailableCash >= cost); option.tooltip = requirement ?? (cost > 0 ? $"Refit cost {Money(cost)}" : ""); diff --git a/Assets/BigShipTycoon/Runtime/SunDeckGrid.cs b/Assets/BigShipTycoon/Runtime/SunDeckGrid.cs index 2468628..5c05c95 100644 --- a/Assets/BigShipTycoon/Runtime/SunDeckGrid.cs +++ b/Assets/BigShipTycoon/Runtime/SunDeckGrid.cs @@ -6,33 +6,46 @@ namespace BigShipTycoon { internal sealed class SunDeckGrid { - private const float Cell = 3f, RailClearance = .65f; + private const float RailClearance = .65f; private readonly Ship ship; + private readonly SunDeckZone zone; private readonly float length, offset, halfBeam; private readonly Vector2 radome; + private readonly bool mega; + private readonly float cellSize; private IReadOnlyList existing; - internal SunDeckGrid(Ship ship, int deckCount = 0) + internal SunDeckGrid(Ship ship, int deckCount = 0, SunDeckZone zone = SunDeckZone.Sky) { this.ship = ship; + this.zone = zone; + mega = ship.HasAftTerrace; + cellSize = mega ? 4.5f : 3f; deckCount = deckCount > 0 ? deckCount : ship.Decks.Count; - int top = deckCount - 1; - length = VesselExterior.DeckLength(ship.Hull.Length, top); - offset = VesselExterior.DeckOffset(ship.Hull.Length, top); - halfBeam = VesselExterior.DeckHalfBeam(ship.Hull.Beam * .5f, top); - Columns = Mathf.FloorToInt((length - 2 * RailClearance) / Cell); - Rows = Mathf.FloorToInt((2 * halfBeam - 2 * RailClearance) / Cell); - Area = new Rect(offset - Columns * Cell * .5f, -Rows * Cell * .5f, Columns * Cell, Rows * Cell); + (length, halfBeam, offset) = MegaDeckGeometry.ForShip(ship, deckCount - 1, deckCount); + Rect footprint = zone == SunDeckZone.AftTerrace ? MegaDeckGeometry.TerraceArea(ship.Hull.Length, ship.Hull.Beam * .5f, deckCount) + : new Rect(offset - length * .5f, -halfBeam, length, 2 * halfBeam); + Columns = Mathf.FloorToInt((footprint.width - 2 * RailClearance) / cellSize); + Rows = Mathf.FloorToInt((footprint.height - 2 * RailClearance) / cellSize); + Vector2 gridSize = new Vector2(Columns, Rows) * cellSize; + Area = new Rect(footprint.center - gridSize * .5f, gridSize); float funnel = offset - length * .24f; - float funnelHalfWidth = halfBeam * .23f + 1.27f; - Funnels = new Rect(funnel - 2.4f, -funnelHalfWidth, 4.8f, 2 * funnelHalfWidth); + float funnelHalfWidth = mega ? halfBeam * .58f + .35f : halfBeam * .23f + 1.27f; radome = new Vector2(funnel + 6.10f, halfBeam * .50f); - float bridge = VesselExterior.BridgeCenter(ship.Hull.Length, deckCount); - Bridge = new Rect(bridge - 4.85f, -halfBeam, 9.7f, 2 * halfBeam); + float bridge = MegaDeckGeometry.BridgeCenter(ship, deckCount); + if (zone == SunDeckZone.Sky) + { + float funnelHalfLength = mega ? 9.2f : 2.4f; + Funnels = new Rect(funnel - funnelHalfLength, -funnelHalfWidth, 2 * funnelHalfLength, 2 * funnelHalfWidth); + float bridgeHalfLength = mega ? 10.5f : 4.85f; + float bridgeHalfWidth = mega ? .66f * halfBeam + 1f : halfBeam; + Bridge = new Rect(bridge - bridgeHalfLength, -bridgeHalfWidth, 2 * bridgeHalfLength, 2 * bridgeHalfWidth); + } - SunPoolStyle pool = ship.SunDeckPlan.Pool; - bool automatic = pool == SunPoolStyle.Automatic && !ship.SunDeckPlan.CustomLayout; + SunDeckPlan plan = ship.SunDeckFor(zone); + SunPoolStyle pool = plan.Pool; + bool automatic = pool == SunPoolStyle.Automatic && !plan.CustomLayout; Facility[] cells = ship.Decks[^1].Cells; bool resort = automatic && (Array.IndexOf(cells, Facility.ResortPool) >= 0 || Array.IndexOf(cells, Facility.WaterPark) >= 0); SelectedPool = pool is SunPoolStyle.Automatic or SunPoolStyle.None @@ -41,14 +54,14 @@ namespace BigShipTycoon internal int Columns { get; } internal int Rows { get; } - internal float CellLength => Cell; - internal float CellWidth => Cell; + internal float CellLength => cellSize; + internal float CellWidth => cellSize; internal Rect Area { get; } internal Rect Bridge { get; } internal Rect Funnels { get; } internal SunPoolStyle SelectedPool { get; } - internal IReadOnlyList Existing => existing ??= ship.SunDeckPlan.CustomLayout - ? ship.SunDeckPlan.Placements ?? Array.Empty() : LegacyFittings(); + internal IReadOnlyList Existing => existing ??= ship.SunDeckFor(zone).CustomLayout + ? ship.SunDeckFor(zone).Placements ?? Array.Empty() : LegacyFittings(); internal int PoolIndex { @@ -63,6 +76,7 @@ namespace BigShipTycoon internal Vector2 PoolBasinHalfSize(SunPoolStyle pool) => Normalize(pool) switch { + SunPoolStyle.Lagoon => new Vector2(11.8f, 4.7f), SunPoolStyle.Resort => new Vector2(Mathf.Min(7.15f, length * .089f), Mathf.Min(2.77f, halfBeam * .39f)), SunPoolStyle.Family => new Vector2(Mathf.Min(4.48f, length * .085f), Mathf.Min(2.18f, halfBeam * .38f)), _ => new Vector2(VesselExterior.PoolHalfLength, VesselExterior.PoolHalfWidth) @@ -72,6 +86,7 @@ namespace BigShipTycoon { SunAttraction.Pool => Normalize(pool) switch { + SunPoolStyle.Lagoon => new Vector2(14.2f, 6.95f), SunPoolStyle.Resort => new Vector2(9.2f, 4.65f), SunPoolStyle.Family => new Vector2(6.5f, 4.1f), _ => new Vector2(4.65f, 3.45f) @@ -80,6 +95,7 @@ namespace BigShipTycoon SunAttraction.Theater => new Vector2(4.3f, 2.7f), SunAttraction.GoKarts => new Vector2(6.3f, 2.6f), SunAttraction.RollerCoaster => new Vector2(7.4f, 3.5f), + SunAttraction.SkyGarden => new Vector2(8.7f, 5.25f), _ => Vector2.zero }; @@ -88,34 +104,36 @@ namespace BigShipTycoon private Vector2Int Bays(SunDeckPlacement item, SunPoolStyle pool) { Vector2 half = HalfSize(item.Kind, pool); - Vector2Int size = new(Mathf.CeilToInt(2 * half.x / Cell), Mathf.CeilToInt(2 * half.y / Cell)); + Vector2Int size = new(Mathf.CeilToInt(2 * half.x / cellSize), Mathf.CeilToInt(2 * half.y / cellSize)); return (item.Rotation & 1) == 0 ? size : new Vector2Int(size.y, size.x); } internal Rect Bounds(SunDeckPlacement item, SunPoolStyle pool) { Vector2Int size = Bays(item, pool); - return new Rect(Area.xMin + item.Column * Cell, Area.yMin + item.Row * Cell, size.x * Cell, size.y * Cell); + return new Rect(Area.xMin + item.Column * cellSize, Area.yMin + item.Row * cellSize, size.x * cellSize, size.y * cellSize); } internal bool IsBlocked(int column, int row) { if ((uint)column >= (uint)Columns || (uint)row >= (uint)Rows) return true; - var cell = new Rect(Area.xMin + column * Cell, Area.yMin + row * Cell, Cell, Cell); + if (zone == SunDeckZone.AftTerrace) + return false; + var cell = new Rect(Area.xMin + column * cellSize, Area.yMin + row * cellSize, cellSize, cellSize); if (cell.Overlaps(Bridge) || cell.Overlaps(Funnels)) return true; float aft = (cell.xMin - offset) / (length * .994f) + .5f; float fore = (cell.xMax - offset) / (length * .994f) + .5f; float width = halfBeam * .992f * Mathf.Min(VesselExterior.SideWidth(aft), VesselExterior.SideWidth(fore)); return Mathf.Max(Mathf.Abs(cell.yMin), Mathf.Abs(cell.yMax)) > width - RailClearance - || cell.Overlaps(new Rect(radome.x - .7f, radome.y - .7f, 1.4f, 1.4f)) - || cell.Overlaps(new Rect(radome.x - .7f, -radome.y - .7f, 1.4f, 1.4f)); + || !mega && (cell.Overlaps(new Rect(radome.x - .7f, radome.y - .7f, 1.4f, 1.4f)) + || cell.Overlaps(new Rect(radome.x - .7f, -radome.y - .7f, 1.4f, 1.4f))); } internal int At(int col, int row, SunPoolStyle pool) { - Vector2 center = Area.min + new Vector2(col + .5f, row + .5f) * Cell; + Vector2 center = Area.min + new Vector2(col + .5f, row + .5f) * cellSize; for (int i = 0; i < Existing.Count; i++) if (Bounds(Existing[i], pool).Contains(center)) return i; @@ -124,12 +142,11 @@ namespace BigShipTycoon internal string PlacementBlock(SunDeckPlacement item, SunPoolStyle pool, IReadOnlyList items, int replacing = -1) { - if ((uint)item.Kind < (uint)SunAttraction.MiniGolf || (uint)item.Kind > (uint)SunAttraction.Pool || (uint)item.Rotation > 3) + if ((uint)item.Kind < (uint)SunAttraction.MiniGolf || (uint)item.Kind > (uint)SunAttraction.SkyGarden || (uint)item.Rotation > 3) return "Select a fitting and turn it in quarter turns."; if (replacing < -1 || replacing >= items.Count || replacing >= 0 && items[replacing].Kind != item.Kind) return "Select a fitting on this sun deck."; - int hull = item.Kind == SunAttraction.Pool && Normalize(pool) == SunPoolStyle.Resort ? Market.Regional - : SunDeckPlan.RequiredHull(item.Kind); + int hull = item.Kind == SunAttraction.Pool ? SunDeckPlan.RequiredHull(Normalize(pool)) : SunDeckPlan.RequiredHull(item.Kind); if (ship.HullIndex < hull) return $"Requires a {Market.Hulls[hull].Name} hull or larger."; diff --git a/Assets/BigShipTycoon/Runtime/SunDeckPlan.cs b/Assets/BigShipTycoon/Runtime/SunDeckPlan.cs index 1f0be28..09e97a3 100644 --- a/Assets/BigShipTycoon/Runtime/SunDeckPlan.cs +++ b/Assets/BigShipTycoon/Runtime/SunDeckPlan.cs @@ -3,10 +3,10 @@ using UnityEngine; namespace BigShipTycoon { - public enum SunPoolStyle { Automatic, None, Compact, Family, Resort } + public enum SunPoolStyle { Automatic, None, Compact, Family, Resort, Lagoon } public enum SunPoolShape { Rectangle, Oval } public enum SunPoolPosition { Midship, Aft, Forward } - public enum SunAttraction { Automatic, None, MiniGolf, Theater, GoKarts, RollerCoaster, Pool } + public enum SunAttraction { Automatic, None, MiniGolf, Theater, GoKarts, RollerCoaster, Pool, SkyGarden } [Serializable] public struct SunDeckPlacement @@ -51,21 +51,24 @@ namespace BigShipTycoon internal static int PoolPriceFor(SunPoolStyle pool) => pool switch { - SunPoolStyle.Compact => 9500, SunPoolStyle.Family => 21000, SunPoolStyle.Resort => 59000, _ => 0 + SunPoolStyle.Compact => 9500, SunPoolStyle.Family => 21000, SunPoolStyle.Resort => 59000, + SunPoolStyle.Lagoon => 145000, _ => 0 }; internal static int AttractionPrice(SunAttraction kind) => kind switch { SunAttraction.MiniGolf => 16000, SunAttraction.Theater => 36000, SunAttraction.GoKarts => 62000, - SunAttraction.RollerCoaster => 145000, _ => 0 + SunAttraction.RollerCoaster => 145000, SunAttraction.SkyGarden => 124000, _ => 0 }; private static int PoolAdmissions(SunPoolStyle pool) => pool switch { - SunPoolStyle.Compact => 42, SunPoolStyle.Family => 86, SunPoolStyle.Resort => 172, _ => 0 + SunPoolStyle.Compact => 42, SunPoolStyle.Family => 86, SunPoolStyle.Resort => 172, + SunPoolStyle.Lagoon => 330, _ => 0 }; private static int AttractionAdmissions(SunAttraction kind) => kind switch { - SunAttraction.MiniGolf => 52, SunAttraction.GoKarts => 78, SunAttraction.RollerCoaster => 124, _ => 0 + SunAttraction.MiniGolf => 52, SunAttraction.GoKarts => 78, SunAttraction.RollerCoaster => 124, + SunAttraction.SkyGarden => 195, _ => 0 }; internal int AddedAmenities => CustomLayout ? AddedCapacity(false) : PoolAdmissions(Pool) + AttractionAdmissions(Attraction); @@ -85,14 +88,19 @@ namespace BigShipTycoon return count; } - internal bool ValidOptions(int hull) => (uint)Pool <= (uint)SunPoolStyle.Resort && (uint)Shape <= (uint)SunPoolShape.Oval + internal bool ValidOptions(int hull) => (uint)Pool <= (uint)SunPoolStyle.Lagoon && (uint)Shape <= (uint)SunPoolShape.Oval && (uint)Position <= (uint)SunPoolPosition.Forward && (uint)Attraction <= (uint)SunAttraction.RollerCoaster - && (Pool != SunPoolStyle.Resort || hull >= Market.Regional) && hull >= RequiredHull(Attraction); + && hull >= RequiredHull(Pool) && hull >= RequiredHull(Attraction); + + internal static int RequiredHull(SunPoolStyle pool) => pool switch + { + SunPoolStyle.Resort => Market.Regional, SunPoolStyle.Lagoon => Market.Mega, _ => 0 + }; internal static int RequiredHull(SunAttraction attraction) => attraction switch { SunAttraction.Theater or SunAttraction.GoKarts => Market.Regional, - SunAttraction.RollerCoaster => Market.Ocean, + SunAttraction.RollerCoaster => Market.Ocean, SunAttraction.SkyGarden => Market.Mega, _ => 0 }; } @@ -100,21 +108,44 @@ namespace BigShipTycoon public sealed partial class Ship { [SerializeField] private SunDeckPlan sunDeckPlan; - public SunDeckPlan SunDeckPlan => sunDeckPlan; - internal int SunDeckPlanCode => sunDeckPlan.Code; + [SerializeField] private SunDeckPlan aftSunDeckPlan; + public SunDeckPlan SunDeckPlan => SunDeckFor(SunDeckZone.Sky); + public bool HasAftTerrace => HullIndex == Market.Mega; + internal int OutdoorAmenityCapacity => sunDeckPlan.AddedAmenities + (HasAftTerrace ? aftSunDeckPlan.AddedAmenities : 0); + internal int OutdoorShowCapacity => sunDeckPlan.AddedShows + (HasAftTerrace ? aftSunDeckPlan.AddedShows : 0); + internal int SunDeckPlanCode => HasAftTerrace ? unchecked(sunDeckPlan.Code * 109 + aftSunDeckPlan.Code) : sunDeckPlan.Code; internal bool HasValidSunDeckPlan => sunDeckPlan.ValidOptions(HullIndex) - && (!sunDeckPlan.CustomLayout || new SunDeckGrid(this).Valid(sunDeckPlan)); - internal void SetSunDeckPlan(SunDeckPlan plan) => sunDeckPlan = plan; + && (!HasAftTerrace || SunDeckFor(SunDeckZone.AftTerrace).ValidOptions(HullIndex)) && SunDecksFitAt(Decks.Count); + + public SunDeckPlan SunDeckFor(SunDeckZone zone) + { + SunDeckPlan stored = zone == SunDeckZone.AftTerrace ? aftSunDeckPlan : sunDeckPlan; + return stored.CustomLayout || !HasAftTerrace ? stored + : new SunDeckPlan { CustomLayout = true, Pool = SunPoolStyle.Compact, Attraction = SunAttraction.None }; + } + + internal bool SupportsSunDeck(SunDeckZone zone) => zone == SunDeckZone.Sky || zone == SunDeckZone.AftTerrace && HasAftTerrace; + + internal bool SunDecksFitAt(int count) => (!sunDeckPlan.CustomLayout || new SunDeckGrid(this, count).Valid(sunDeckPlan)) + && (!HasAftTerrace || new SunDeckGrid(this, count, SunDeckZone.AftTerrace).Valid(SunDeckFor(SunDeckZone.AftTerrace))); + + internal void SetSunDeckPlan(SunDeckPlan plan, SunDeckZone zone) + { + if (zone == SunDeckZone.AftTerrace) + aftSunDeckPlan = plan; + else + sunDeckPlan = plan; + } } public sealed partial class Company { - internal static int SunDeckCost(Ship ship, SunDeckPlan next) + internal static int SunDeckCost(Ship ship, SunDeckPlan next, SunDeckZone zone = SunDeckZone.Sky) { - SunDeckPlan current = ship.SunDeckPlan; + SunDeckPlan current = ship.SunDeckFor(zone); if (current.CustomLayout || next.CustomLayout) { - var grid = new SunDeckGrid(ship); + var grid = new SunDeckGrid(ship, zone: zone); if (grid.PoolIndex < 0 || next.Pool == grid.SelectedPool) return 0; int priorPrice = grid.Existing[grid.PoolIndex].Included ? 0 : SunDeckPlan.PoolPriceFor(grid.SelectedPool); @@ -126,16 +157,18 @@ namespace BigShipTycoon return pool + attraction; } - public string ChangeSunDeck(Ship ship, SunDeckPlan next) + public string ChangeSunDeck(Ship ship, SunDeckPlan next, SunDeckZone zone = SunDeckZone.Sky) { if (ship == null || !Fleet.Contains(ship)) return "Choose a ship from your fleet."; + if (!ship.SupportsSunDeck(zone)) + return "The split aft terrace requires a MEGA Ocean Liner."; if (!next.ValidOptions(ship.HullIndex)) return "This fitting requires a larger hull."; - int cost = SunDeckCost(ship, next); - var grid = new SunDeckGrid(ship); - if (ship.SunDeckPlan.CustomLayout || next.CustomLayout) + int cost = SunDeckCost(ship, next, zone); + var grid = new SunDeckGrid(ship, zone: zone); + if (ship.SunDeckFor(zone).CustomLayout || next.CustomLayout) { int pool = grid.PoolIndex; if (next.Pool is SunPoolStyle.None or SunPoolStyle.Automatic) @@ -150,56 +183,61 @@ namespace BigShipTycoon return $"The company needs ${cost:N0} available for this refit."; Cash -= cost; - ship.SetSunDeckPlan(next); + ship.SetSunDeckPlan(next, zone); return null; } - internal static int SunDeckPlacementPrice(Ship ship, SunDeckPlacement placement, int replacing = -1) + internal static int SunDeckPlacementPrice(Ship ship, SunDeckPlacement placement, int replacing = -1, + SunDeckZone zone = SunDeckZone.Sky) { if (replacing >= 0) return 0; - return placement.Kind == SunAttraction.Pool ? SunDeckPlan.PoolPriceFor(new SunDeckGrid(ship).SelectedPool) + return placement.Kind == SunAttraction.Pool ? SunDeckPlan.PoolPriceFor(new SunDeckGrid(ship, zone: zone).SelectedPool) : SunDeckPlan.AttractionPrice(placement.Kind); } - public string SunDeckPlacementBlock(Ship ship, SunDeckPlacement placement, int replacing = -1) + public string SunDeckPlacementBlock(Ship ship, SunDeckPlacement placement, int replacing = -1, SunDeckZone zone = SunDeckZone.Sky) { if (ship == null || !Fleet.Contains(ship)) return "Choose a ship from your fleet."; - var grid = new SunDeckGrid(ship); + if (!ship.SupportsSunDeck(zone)) + return "The split aft terrace requires a MEGA Ocean Liner."; + var grid = new SunDeckGrid(ship, zone: zone); string block = grid.PlacementBlock(placement, grid.SelectedPool, grid.Existing, replacing); if (block != null) return block; - return AvailableCash < SunDeckPlacementPrice(ship, placement, replacing) ? "The company needs more cash." : null; + return AvailableCash < SunDeckPlacementPrice(ship, placement, replacing, zone) ? "The company needs more cash." : null; } - public string PlaceSunDeck(Ship ship, SunDeckPlacement placement, int replacing = -1) + public string PlaceSunDeck(Ship ship, SunDeckPlacement placement, int replacing = -1, SunDeckZone zone = SunDeckZone.Sky) { - string block = SunDeckPlacementBlock(ship, placement, replacing); + string block = SunDeckPlacementBlock(ship, placement, replacing, zone); if (block != null) return block; - var grid = new SunDeckGrid(ship); - SunDeckPlan next = grid.Customize(ship.SunDeckPlan, replacing < 0 ? 1 : 0); + var grid = new SunDeckGrid(ship, zone: zone); + SunDeckPlan next = grid.Customize(ship.SunDeckFor(zone), replacing < 0 ? 1 : 0); int index = replacing < 0 ? next.Placements.Length - 1 : replacing; placement.Included = replacing >= 0 && next.Placements[index].Included; next.Placements[index] = placement; - Cash -= SunDeckPlacementPrice(ship, placement, replacing); - ship.SetSunDeckPlan(next); + Cash -= SunDeckPlacementPrice(ship, placement, replacing, zone); + ship.SetSunDeckPlan(next, zone); return null; } - public string RemoveSunDeck(Ship ship, int index) + public string RemoveSunDeck(Ship ship, int index, SunDeckZone zone = SunDeckZone.Sky) { if (ship == null || !Fleet.Contains(ship)) return "Choose a ship from your fleet."; - var grid = new SunDeckGrid(ship); + if (!ship.SupportsSunDeck(zone)) + return "The split aft terrace requires a MEGA Ocean Liner."; + var grid = new SunDeckGrid(ship, zone: zone); if ((uint)index >= (uint)grid.Existing.Count) return "Select a fitted attraction to remove."; - SunDeckPlan next = grid.Customize(ship.SunDeckPlan, omit: index); + SunDeckPlan next = grid.Customize(ship.SunDeckFor(zone), omit: index); SunDeckPlacement removed = grid.Existing[index]; if (!removed.Included) - Cash += SunDeckPlacementPrice(ship, removed) / 4; - ship.SetSunDeckPlan(next); + Cash += SunDeckPlacementPrice(ship, removed, zone: zone) / 4; + ship.SetSunDeckPlan(next, zone); return null; } } diff --git a/Assets/BigShipTycoon/Runtime/VesselExterior.cs b/Assets/BigShipTycoon/Runtime/VesselExterior.cs index 6725aec..7548a88 100644 --- a/Assets/BigShipTycoon/Runtime/VesselExterior.cs +++ b/Assets/BigShipTycoon/Runtime/VesselExterior.cs @@ -12,7 +12,8 @@ namespace BigShipTycoon internal enum Paint { Navy, Ivory, Pearl, Gold, Teak, TeakSeam, Steel, Black, Glass, BlueGlass, LitGlass, Lounge, - Lifeboat, Pool, Antifouling, DeckCanvas, PortLight, StarboardLight, Turf, Fringe + Lifeboat, Pool, Antifouling, DeckCanvas, PortLight, StarboardLight, Turf, Fringe, + MegaHull, AtriumGlass, DeckTrack, FritGlass } private readonly Dictionary batches = new Dictionary(); @@ -25,7 +26,7 @@ namespace BigShipTycoon this.ship = ship; this.length = length; this.beam = beam; - balconies = 21 + ship.HullIndex * 6; + balconies = ship.HullIndex == Market.Mega ? 66 : 21 + ship.HullIndex * 6; } public IReadOnlyDictionary Meshes() @@ -33,8 +34,16 @@ namespace BigShipTycoon BuildHull(); for (int deck = 0; deck < ship.Decks.Count; deck++) BuildPassengerDeck(deck); - BuildBridgeAndRoof(); - BuildLifeboats(); + if (ship.HullIndex == Market.Mega) + { + BuildMegaRoof(); + BuildMegaLifeboats(); + } + else + { + BuildBridgeAndRoof(); + BuildLifeboats(); + } return batches; } @@ -47,21 +56,33 @@ namespace BigShipTycoon private void BuildHull() { - Vector2[] outline = Outline(length, beam, 0, HullStations); + bool mega = ship.HullIndex == Market.Mega; + int samples = ExteriorHullStations; + Vector2[] outline = Outline(length, beam, 0, samples); Vector2 center = Vector2.zero; Coat(Paint.Antifouling).Loft(outline, center, false, new Vector3(.875f, -2.65f, .53f), new Vector3(.936f, -1.78f, .73f), new Vector3(.967f, -.83f, .87f), new Vector3(.984f, -.13f, .933f)); Coat(Paint.Black).Loft(outline, center, false, new Vector3(.984f, -.13f, .933f), new Vector3(.991f, .27f, .969f)); - Coat(Paint.Navy).Loft(outline, center, false, new Vector3(.991f, .27f, .969f), - new Vector3(.996f, 1.22f, .988f), new Vector3(1, 2.39f, 1), - new Vector3(1.01f, 4.65f, 1.03f)); - Coat(Paint.Gold).Loft(outline, center, false, new Vector3(1.013f, 3.54f, 1.025f), - new Vector3(1.013f, 3.61f, 1.026f)); + if (mega) + { + Coat(Paint.Navy).Loft(outline, center, false, new Vector3(.991f, .27f, .969f), new Vector3(.996f, 1.22f, .988f)); + Coat(Paint.MegaHull).Loft(outline, center, false, new Vector3(.996f, 1.22f, .988f), + new Vector3(1, 2.39f, 1), new Vector3(1.01f, 4.65f, 1.03f)); + Coat(Paint.AtriumGlass).Loft(outline, center, false, new Vector3(1.013f, 4.24f, 1.030f), + new Vector3(1.013f, 4.40f, 1.033f)); + } + else + { + Coat(Paint.Navy).Loft(outline, center, false, new Vector3(.991f, .27f, .969f), + new Vector3(.996f, 1.22f, .988f), new Vector3(1, 2.39f, 1), new Vector3(1.01f, 4.65f, 1.03f)); + Coat(Paint.Gold).Loft(outline, center, false, new Vector3(1.013f, 3.54f, 1.025f), + new Vector3(1.013f, 3.61f, 1.026f)); + } Coat(Paint.Ivory).Loft(outline, center, true, new Vector3(.998f, 4.47f, 1.015f), new Vector3(1.013f, 5.14f, 1.027f), new Vector3(1.003f, 5.32f, 1.015f)); - Vector2[] promenade = Outline(length * .971f, beam * .979f, 0, HullStations); + Vector2[] promenade = Outline(length * .971f, beam * .979f, 0, samples); Coat(Paint.Teak).Loft(promenade, center, true, new Vector3(.997f, 5.32f, 1), new Vector3(1, DeckBase, 1)); Rails(promenade, DeckBase, DeckBase + .77f, 2.1f); @@ -69,12 +90,12 @@ namespace BigShipTycoon for (int side = -1; side <= 1; side += 2) { BuildHullFittings(side); - int portholes = 25 + ship.HullIndex * 7; + int portholes = mega ? 76 : 25 + ship.HullIndex * 7; for (int i = 0; i < portholes; i++) { float station = Mathf.Lerp(.105f, .837f, i / (float)(portholes - 1)); var (at, along, outward) = SideFrame(station, 2.76f, length * 1.002f, - beam * 1.006f, 0, side, HullStations); + beam * 1.006f, 0, side, samples); Coat(Paint.Steel).Disc(at + outward * .043f, along * (side * .22f), Vector3.up * .238f, 12); Coat(Paint.Black).Disc(at + outward * .048f, along * (side * .178f), Vector3.up * .194f, 12); Paint pane = (i + 5 * side) % 7 == 0 ? Paint.Lounge : Paint.Glass; @@ -82,13 +103,15 @@ namespace BigShipTycoon } var (door, hinge, face) = SideFrame(.56f, 3.22f, length * 1.004f, beam * 1.016f, 0, side, - HullStations); + samples); SidePanel(Coat(Paint.Black), door + face * .027f, hinge, side, 2.22f, 1.66f); SidePanel(Coat(Paint.Navy), door + face * .032f, hinge, side, 2.10f, 1.53f); SidePanel(Coat(Paint.Steel), door + face * .04f + hinge * .82f, hinge, side, .21f, .08f); } BuildForecastle(); + if (mega) + BuildMegaHullDetail(); } private void BuildForecastle() @@ -127,6 +150,11 @@ namespace BigShipTycoon private void BuildPassengerDeck(int deck) { + if (ship.HullIndex == Market.Mega) + { + BuildMegaPassengerDeck(deck); + return; + } float y = DeckBase + deck * DeckSpacing; float roof = y + DeckSpacing; var (deckLength, deckBeam, offset) = DeckFootprint(deck); @@ -338,7 +366,7 @@ namespace BigShipTycoon private void BuildSunDeck(SunDeckLayout plan, float top) { - var starts = new int[(int)Paint.Fringe + 1]; + var starts = new int[(int)Paint.FritGlass + 1]; foreach (SunDeckVenue venue in plan.Venues) { System.Array.Clear(starts, 0, starts.Length); @@ -510,26 +538,32 @@ namespace BigShipTycoon internal readonly SunDeckVenue[] Venues; internal readonly SunDeckVenue Pool; - internal SunDeckLayout(Ship ship) + internal SunDeckLayout(Ship ship, SunDeckZone zone) { int deck = ship.Decks.Count - 1; - Length = DeckLength(ship.Hull.Length, deck); - Offset = DeckOffset(ship.Hull.Length, deck); - HalfBeam = DeckHalfBeam(ship.Hull.Beam * .5f, deck); + if (zone == SunDeckZone.AftTerrace) + { + Rect area = MegaDeckGeometry.TerraceArea(ship.Hull.Length, ship.Hull.Beam * .5f, ship.Decks.Count); + Length = area.width; + Offset = area.center.x; + HalfBeam = area.height * .5f; + } + else + (Length, HalfBeam, Offset) = MegaDeckGeometry.ForShip(ship, deck, ship.Decks.Count); Facility[] cells = ship.Decks[deck].Cells; - SunDeckPlan design = ship.SunDeckPlan; - Custom = design.CustomLayout; + SunDeckPlan design = ship.SunDeckFor(zone); + Custom = design.CustomLayout || zone == SunDeckZone.AftTerrace; OvalPool = design.Shape == SunPoolShape.Oval; Shade = !design.NoShade; ExtraLoungers = design.ExtraLoungers; if (Custom) { - var grid = new SunDeckGrid(ship); + var grid = new SunDeckGrid(ship, zone: zone); SunDeckPlacement[] placements = design.Placements ?? System.Array.Empty(); Venues = new SunDeckVenue[placements.Length]; Pool = new SunDeckVenue(SunAttraction.None, new Vector2(Offset, 0), Vector2.zero); HasPool = false; - Resort = design.Pool == SunPoolStyle.Resort; + Resort = design.Pool is SunPoolStyle.Resort or SunPoolStyle.Lagoon; PoolHalfSize = grid.PoolBasinHalfSize(design.Pool); for (int i = 0; i < placements.Length; i++) { @@ -559,7 +593,7 @@ namespace BigShipTycoon SunPoolPosition.Aft => -.09f, SunPoolPosition.Forward => .11f, _ => Resort ? .033f : .01f }); float poolCenter = Mathf.Clamp(desired, Offset - Length * .24f + PoolHalfSize.x + 4.1f, - BridgeCenter(ship.Hull.Length, ship.Decks.Count) - PoolHalfSize.x - 6.1f); + MegaDeckGeometry.BridgeCenter(ship, ship.Decks.Count) - PoolHalfSize.x - 6.1f); Pool = new SunDeckVenue(HasPool ? SunAttraction.Pool : SunAttraction.None, new Vector2(poolCenter, 0), PoolHalfSize); SunAttraction attraction = design.Attraction == SunAttraction.Automatic @@ -577,7 +611,7 @@ namespace BigShipTycoon internal bool Theater => System.Array.Exists(Venues, venue => venue.Kind == SunAttraction.Theater); internal float PoolCenter => Pool.Center.x; - internal int Loungers => Custom && !HasPool ? 0 : (Resort ? 10 : 8) + (ExtraLoungers ? 2 : 0); + internal int Loungers => Custom && !HasPool ? 0 : (PoolHalfSize.x > 10f ? 16 : Resort ? 10 : 8) + (ExtraLoungers ? 2 : 0); internal float LoungerDistance => Custom ? PoolHalfSize.y + .86f : HalfBeam * LoungerBeamFraction; internal float ParasolX => PoolHalfSize.x + (Custom ? .68f : 1.25f); internal float ParasolDistance => Custom ? Pool.HalfSize.y - 1.27f : HalfBeam * .55f; @@ -591,7 +625,7 @@ namespace BigShipTycoon } } - internal static SunDeckLayout SunDeck(Ship ship) => new SunDeckLayout(ship); + internal static SunDeckLayout SunDeck(Ship ship, SunDeckZone zone = SunDeckZone.Sky) => new SunDeckLayout(ship, zone); private void BuildLounger(float x, float top, float sideDistance, int side) { @@ -703,6 +737,8 @@ namespace BigShipTycoon internal static float DeckOffset(float hullLength, int deck) => -hullLength * (.034f + .0065f * deck); internal static float DeckHalfBeam(float halfBeam, int deck) => halfBeam * (.85f - .024f * deck); + private int ExteriorHullStations => ship.HullIndex == Market.Mega ? 72 : HullStations; + private (float Length, float Beam, float Offset) DeckFootprint(int deck) => (DeckLength(length, deck), DeckHalfBeam(beam, deck), DeckOffset(length, deck)); diff --git a/Assets/BigShipTycoon/Runtime/VesselFittings.cs b/Assets/BigShipTycoon/Runtime/VesselFittings.cs index e30ab9a..328b59c 100644 --- a/Assets/BigShipTycoon/Runtime/VesselFittings.cs +++ b/Assets/BigShipTycoon/Runtime/VesselFittings.cs @@ -11,7 +11,7 @@ namespace BigShipTycoon { float y = .51f + mark * .247f; var (at, along, outward) = SideFrame(.895f, y, length * 1.001f, - beam * Mathf.Lerp(.977f, 1f, mark / 5f), 0, side, HullStations); + beam * Mathf.Lerp(.977f, 1f, mark / 5f), 0, side, ExteriorHullStations); at += outward * .038f; SidePanel(Coat(Paint.Pearl), at, along, side, mark % 3 == 0 ? .32f : .18f, .046f); if (mark % 3 == 0) @@ -22,7 +22,7 @@ namespace BigShipTycoon { float station = position == 0 ? .113f : .835f; var (at, along, outward) = SideFrame(station, 4.52f, length * 1.010f, beam * 1.029f, - 0, side, HullStations); + 0, side, ExteriorHullStations); Coat(Paint.Steel).Disc(at + outward * .046f, along * (side * .47f), Vector3.up * .21f, 12); Coat(Paint.Black).Disc(at + outward * .054f, along * (side * .367f), Vector3.up * .136f, 12); Coat(Paint.Steel).Rod(at + outward * .062f + along * .085f - Vector3.up * .121f, @@ -30,7 +30,7 @@ namespace BigShipTycoon } // Frames and a cabling run break up the flush embarkation hatch. - var (door, hinge, face) = SideFrame(.56f, 3.22f, length * 1.004f, beam * 1.016f, 0, side, HullStations); + var (door, hinge, face) = SideFrame(.56f, 3.22f, length * 1.004f, beam * 1.016f, 0, side, ExteriorHullStations); Vector3 center = door + face * .046f; SidePanel(Coat(Paint.Steel), center + Vector3.up * .718f, hinge, side, 2.08f, .034f); SidePanel(Coat(Paint.Steel), center - Vector3.up * .724f, hinge, side, 2.08f, .034f); diff --git a/Assets/BigShipTycoon/Runtime/VisualSmoke.cs b/Assets/BigShipTycoon/Runtime/VisualSmoke.cs index df4f7d8..397cd29 100644 --- a/Assets/BigShipTycoon/Runtime/VisualSmoke.cs +++ b/Assets/BigShipTycoon/Runtime/VisualSmoke.cs @@ -810,6 +810,82 @@ namespace BigShipTycoon "Resolve the late group and clear the next departure")) yield break; + company.Cash = 12_000_000; + company.Voyages = 20; + company.Reputation = 85; + company.Flagship = false; + if (!SubmitSmoke("nav-2") || !SubmitSmoke("yard-5") + || !CheckSmoke(root.Q