diff --git a/Assets/Resources/Ending.meta b/Assets/Resources/Ending.meta
new file mode 100644
index 0000000..fa23be8
--- /dev/null
+++ b/Assets/Resources/Ending.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: b5a48502b2fab954ebffe1e0cd4e742c
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Resources/Ending/EarthAir.shader b/Assets/Resources/Ending/EarthAir.shader
new file mode 100644
index 0000000..f8d0860
--- /dev/null
+++ b/Assets/Resources/Ending/EarthAir.shader
@@ -0,0 +1,58 @@
+// The ending's Earth's air: a shell a little bigger than the ball, drawn from the inside, glowing just past the ball's edge
+// and fading out into space. Dusty brown while the ball is dead, blue once it lives.
+Shader "GrassCutter/EarthAir"
+{
+ Properties
+ {
+ _SunDir ("Sun (world)", Vector) = (0, 0, 1, 0)
+ _AirColor ("Air", Color) = (0.8, 0.55, 0.3, 1)
+ _Edge ("Edge (cos at the ball's rim)", Float) = 0.33
+ _Power ("Power", Float) = 1
+ }
+ SubShader
+ {
+ Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "RenderPipeline" = "UniversalPipeline" "IgnoreProjector" = "True" }
+ Pass
+ {
+ Name "Air"
+ Tags { "LightMode" = "UniversalForward" }
+ Blend One One
+ ZWrite Off
+ Cull Front
+ HLSLPROGRAM
+ #pragma vertex vert
+ #pragma fragment frag
+ #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
+ CBUFFER_START(UnityPerMaterial)
+ float4 _SunDir;
+ float4 _AirColor;
+ float _Edge;
+ float _Power;
+ CBUFFER_END
+
+ struct Attributes { float4 positionOS : POSITION; float3 normalOS : NORMAL; };
+ struct Varyings { float4 positionCS : SV_POSITION; float3 normalWS : TEXCOORD0; float3 positionWS : TEXCOORD1; };
+
+ Varyings vert(Attributes v)
+ {
+ Varyings o;
+ o.positionWS = TransformObjectToWorld(v.positionOS.xyz);
+ o.positionCS = TransformWorldToHClip(o.positionWS);
+ o.normalWS = TransformObjectToWorldNormal(v.normalOS);
+ return o;
+ }
+
+ float4 frag(Varyings i) : SV_Target
+ {
+ float3 n = normalize(i.normalWS);
+ float3 view = normalize(GetCameraPositionWS() - i.positionWS);
+ // the far side of the shell: 0 at its own rim, _Edge where it meets the ball's rim
+ float k = saturate(-dot(n, view) / _Edge);
+ float glow = pow(k, 1.6) * (1 - smoothstep(0.92, 1.0, k) * 0.4);
+ float lit = saturate(dot(n, normalize(_SunDir.xyz)) * 0.8 + 0.35);
+ return float4(_AirColor.rgb * glow * lit * _Power, 1);
+ }
+ ENDHLSL
+ }
+ }
+}
diff --git a/Assets/Resources/Ending/EarthAir.shader.meta b/Assets/Resources/Ending/EarthAir.shader.meta
new file mode 100644
index 0000000..f0cf55c
--- /dev/null
+++ b/Assets/Resources/Ending/EarthAir.shader.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: f936d69a63a436b4ba232598ed960eaa
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Resources/Ending/EarthGlobe.shader b/Assets/Resources/Ending/EarthGlobe.shader
new file mode 100644
index 0000000..20a6d14
--- /dev/null
+++ b/Assets/Resources/Ending/EarthGlobe.shader
@@ -0,0 +1,155 @@
+// The ending's Earth: a scorched, dried-out ball that turns green from wherever the seeds come down. Each seed is a cap on
+// the sphere (its centre in the ball's own space, and how far it has spread, in radians) with a ragged, glowing front;
+// clouds and the sea's shine come back with the green. Lit by its own sun, so it reads the same wherever it is put.
+Shader "GrassCutter/EarthGlobe"
+{
+ Properties
+ {
+ _DryTex ("Dry", 2D) = "white" {}
+ _GreenTex ("Green", 2D) = "white" {}
+ _SunDir ("Sun (world)", Vector) = (0, 0, 1, 0)
+ _AirColor ("Air", Color) = (0.8, 0.55, 0.3, 1)
+ _Life ("Life", Range(0, 1)) = 0
+ _SeedCount ("Seeds", Float) = 0
+ }
+ SubShader
+ {
+ Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "RenderPipeline" = "UniversalPipeline" }
+ Pass
+ {
+ Name "Earth"
+ Tags { "LightMode" = "UniversalForward" }
+ HLSLPROGRAM
+ #pragma vertex vert
+ #pragma fragment frag
+ #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
+
+ TEXTURE2D(_DryTex); SAMPLER(sampler_DryTex);
+ TEXTURE2D(_GreenTex); SAMPLER(sampler_GreenTex);
+ CBUFFER_START(UnityPerMaterial)
+ float4 _DryTex_ST, _GreenTex_ST;
+ float4 _SunDir;
+ float4 _AirColor;
+ float _Life;
+ float _SeedCount;
+ CBUFFER_END
+ // xyz: the seed's centre on the ball (object space, unit), w: how far it has spread (radians)
+ float4 _Seeds[12];
+ // x: how bright the seed's front still is (it goes out once the patch has done spreading)
+ float4 _SeedFx[12];
+
+ struct Attributes { float4 positionOS : POSITION; float3 normalOS : NORMAL; };
+ struct Varyings
+ {
+ float4 positionCS : SV_POSITION;
+ float3 dirOS : TEXCOORD0;
+ float3 normalWS : TEXCOORD1;
+ float3 positionWS : TEXCOORD2;
+ };
+
+ Varyings vert(Attributes v)
+ {
+ Varyings o;
+ o.positionWS = TransformObjectToWorld(v.positionOS.xyz);
+ o.positionCS = TransformWorldToHClip(o.positionWS);
+ o.normalWS = TransformObjectToWorldNormal(v.normalOS);
+ o.dirOS = v.positionOS.xyz;
+ return o;
+ }
+
+ float hash(float3 p)
+ {
+ p = frac(p * 0.3183099 + 0.1);
+ p *= 17.0;
+ return frac(p.x * p.y * p.z * (p.x + p.y + p.z));
+ }
+
+ float vnoise(float3 x)
+ {
+ float3 i = floor(x);
+ float3 f = frac(x);
+ f = f * f * (3.0 - 2.0 * f);
+ return lerp(lerp(lerp(hash(i + float3(0, 0, 0)), hash(i + float3(1, 0, 0)), f.x),
+ lerp(hash(i + float3(0, 1, 0)), hash(i + float3(1, 1, 0)), f.x), f.y),
+ lerp(lerp(hash(i + float3(0, 0, 1)), hash(i + float3(1, 0, 1)), f.x),
+ lerp(hash(i + float3(0, 1, 1)), hash(i + float3(1, 1, 1)), f.x), f.y), f.z);
+ }
+
+ float fbm(float3 p)
+ {
+ float s = 0, a = 0.5;
+ for (int k = 0; k < 5; k++) { s += a * vnoise(p); p = p * 2.03 + 17.1; a *= 0.5; }
+ return s;
+ }
+
+ // the map is equirectangular; the derivatives come from whichever of two seams is further away, so the
+ // line where the longitude wraps never shows
+ float3 SampleMap(TEXTURE2D_PARAM(tex, smp), float2 uv, float2 dx, float2 dy)
+ {
+ return SAMPLE_TEXTURE2D_GRAD(tex, smp, uv, dx, dy).rgb;
+ }
+
+ float4 frag(Varyings i) : SV_Target
+ {
+ float3 d = normalize(i.dirOS);
+ float lon = atan2(d.z, d.x);
+ float lat = asin(clamp(d.y, -1, 1));
+ float2 uv = float2(lon / (2 * PI) + 0.5, lat / PI + 0.5);
+ float2 uv2 = float2(frac(uv.x + 0.5) - 0.5, uv.y);
+ float2 dx = ddx(uv), dy = ddy(uv), dx2 = ddx(uv2), dy2 = ddy(uv2);
+ if (abs(dx2.x) + abs(dy2.x) < abs(dx.x) + abs(dy.x)) { dx = dx2; dy = dy2; }
+ float3 dry = SampleMap(TEXTURE2D_ARGS(_DryTex, sampler_DryTex), uv, dx, dy);
+ float3 green = SampleMap(TEXTURE2D_ARGS(_GreenTex, sampler_GreenTex), uv, dx, dy);
+
+ // how green this spot is, and how close it is to a front that is still moving
+ float wob = fbm(d * 7.0) - 0.5;
+ float wob2 = fbm(d * 23.0 + 5.3) - 0.5;
+ float g = 0, front = 0;
+ for (int s = 0; s < 12; s++)
+ {
+ if (s >= (int)_SeedCount) break;
+ float4 sd = _Seeds[s];
+ if (sd.w <= 0) continue;
+ float ang = acos(clamp(dot(d, sd.xyz), -1, 1));
+ // ragged at the front; a seed spread past 4.7 has covered the whole ball whatever the wobble
+ float reach = sd.w * (1 + wob * 0.55 + wob2 * 0.18);
+ float e = reach - ang;
+ g = max(g, smoothstep(0, 0.035, e));
+ front = max(front, exp(-abs(e) / 0.011) * _SeedFx[s].x * smoothstep(0, 0.02, sd.w));
+ }
+
+ float water = saturate((green.b - max(green.r, green.g * 0.8)) * 4.0);
+ float3 albedo = lerp(dry, green, g);
+
+ float3 n = normalize(i.normalWS);
+ float3 sun = normalize(_SunDir.xyz);
+ float3 view = normalize(GetCameraPositionWS() - i.positionWS);
+ float ndl = dot(n, sun);
+ float light = smoothstep(-0.12, 0.55, ndl) * 1.05 + 0.035;
+
+ // clouds come back over the green; the dead ball only has thin streaks of dust
+ float3 cd = d;
+ float cs = _Time.y * 0.004;
+ cd = float3(cd.x * cos(cs) - cd.z * sin(cs), cd.y, cd.x * sin(cs) + cd.z * cos(cs));
+ float cn = fbm(cd * 4.5 + float3(0, cd.x * 2.0, 0));
+ float cloud = smoothstep(0.56, 0.78, cn) * (0.15 + 0.85 * g) * _Life * 0.85;
+ float dust = smoothstep(0.55, 0.8, fbm(cd * float3(3, 9, 3) + 11.0)) * (1 - g) * 0.25;
+
+ float3 col = albedo * light;
+ // the sea's shine
+ float3 h = normalize(sun + view);
+ float spec = pow(saturate(dot(n, h)), 60) * water * g * saturate(ndl * 4);
+ col += spec * float3(1, 0.95, 0.85) * 0.6;
+ col = lerp(col, float3(0.6, 0.43, 0.28) * light, dust);
+ col = lerp(col, float3(1, 1, 1) * (light * 0.95 + 0.03), cloud);
+ // the air seen edge on
+ float rim = pow(1 - saturate(dot(n, view)), 3.0);
+ col += _AirColor.rgb * rim * saturate(ndl * 0.8 + 0.45) * 0.9;
+ // the moving front glows, day side or night; softer out at sea
+ col += float3(0.55, 1.0, 0.3) * front * (0.35 + 0.65 * (1 - water)) * 1.1;
+ return float4(col, 1);
+ }
+ ENDHLSL
+ }
+ }
+}
diff --git a/Assets/Resources/Ending/EarthGlobe.shader.meta b/Assets/Resources/Ending/EarthGlobe.shader.meta
new file mode 100644
index 0000000..b32e5c9
--- /dev/null
+++ b/Assets/Resources/Ending/EarthGlobe.shader.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: b5db199a12a5d1c4e81aa7793db0fb66
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Resources/Ending/earth_dry.png b/Assets/Resources/Ending/earth_dry.png
new file mode 100644
index 0000000..6bddcf4
--- /dev/null
+++ b/Assets/Resources/Ending/earth_dry.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:233fb82a1961ade7e93dcbb6cceb4011bfb50924fc64cb91f8969225a9d86fe9
+size 3173468
diff --git a/Assets/Resources/Ending/earth_dry.png.meta b/Assets/Resources/Ending/earth_dry.png.meta
new file mode 100644
index 0000000..41d5a93
--- /dev/null
+++ b/Assets/Resources/Ending/earth_dry.png.meta
@@ -0,0 +1,132 @@
+fileFormatVersion: 2
+guid: 293b6ffc779149546ae2aa858118ddf2
+TextureImporter:
+ internalIDToNameTable: []
+ externalObjects: {}
+ serializedVersion: 13
+ mipmaps:
+ mipMapMode: 0
+ enableMipMap: 1
+ sRGBTexture: 1
+ linearTexture: 0
+ fadeOut: 0
+ borderMipMap: 0
+ mipMapsPreserveCoverage: 0
+ alphaTestReferenceValue: 0.5
+ mipMapFadeDistanceStart: 1
+ mipMapFadeDistanceEnd: 3
+ bumpmap:
+ convertToNormalMap: 0
+ externalNormalMap: 0
+ heightScale: 0.25
+ normalMapFilter: 0
+ flipGreenChannel: 0
+ isReadable: 0
+ streamingMipmaps: 0
+ streamingMipmapsPriority: 0
+ vTOnly: 0
+ ignoreMipmapLimit: 0
+ grayScaleToAlpha: 0
+ generateCubemap: 6
+ cubemapConvolution: 0
+ seamlessCubemap: 0
+ textureFormat: 1
+ maxTextureSize: 2048
+ textureSettings:
+ serializedVersion: 2
+ filterMode: 1
+ aniso: 1
+ mipBias: 0
+ wrapU: 0
+ wrapV: 0
+ wrapW: 0
+ nPOTScale: 1
+ lightmap: 0
+ compressionQuality: 50
+ spriteMode: 0
+ spriteExtrude: 1
+ spriteMeshType: 1
+ alignment: 0
+ spritePivot: {x: 0.5, y: 0.5}
+ spritePixelsToUnits: 100
+ spriteBorder: {x: 0, y: 0, z: 0, w: 0}
+ spriteGenerateFallbackPhysicsShape: 1
+ alphaUsage: 1
+ alphaIsTransparency: 0
+ spriteTessellationMethod: 0
+ spriteTessellationDetail: -1
+ spriteGeometrySubdivision: -1
+ textureType: 0
+ textureShape: 1
+ singleChannelComponent: 0
+ flipbookRows: 1
+ flipbookColumns: 1
+ maxTextureSizeSet: 0
+ compressionQualitySet: 0
+ textureFormatSet: 0
+ ignorePngGamma: 0
+ applyGammaDecoding: 0
+ swizzle: 50462976
+ cookieLightType: 0
+ platformSettings:
+ - serializedVersion: 4
+ buildTarget: DefaultTexturePlatform
+ maxTextureSize: 2048
+ resizeAlgorithm: 0
+ textureFormat: -1
+ textureCompression: 1
+ compressionQuality: 50
+ crunchedCompression: 0
+ allowsAlphaSplitting: 0
+ overridden: 0
+ ignorePlatformSupport: 0
+ androidETC2FallbackOverride: 0
+ forceMaximumCompressionQuality_BC6H_BC7: 0
+ - serializedVersion: 4
+ buildTarget: Standalone
+ maxTextureSize: 2048
+ resizeAlgorithm: 0
+ textureFormat: -1
+ textureCompression: 1
+ compressionQuality: 50
+ crunchedCompression: 0
+ allowsAlphaSplitting: 0
+ overridden: 0
+ ignorePlatformSupport: 0
+ androidETC2FallbackOverride: 0
+ forceMaximumCompressionQuality_BC6H_BC7: 0
+ - serializedVersion: 4
+ buildTarget: WebGL
+ maxTextureSize: 2048
+ resizeAlgorithm: 0
+ textureFormat: -1
+ textureCompression: 1
+ compressionQuality: 50
+ crunchedCompression: 0
+ allowsAlphaSplitting: 0
+ overridden: 0
+ ignorePlatformSupport: 0
+ androidETC2FallbackOverride: 0
+ forceMaximumCompressionQuality_BC6H_BC7: 0
+ spriteSheet:
+ serializedVersion: 2
+ sprites: []
+ outline: []
+ customData:
+ physicsShape: []
+ bones: []
+ spriteID:
+ internalID: 0
+ vertices: []
+ indices:
+ edges: []
+ weights: []
+ secondaryTextures: []
+ spriteCustomMetadata:
+ entries: []
+ nameFileIdTable: {}
+ mipmapLimitGroupName:
+ pSDRemoveMatte: 0
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Resources/Ending/earth_green.png b/Assets/Resources/Ending/earth_green.png
new file mode 100644
index 0000000..c9b34bb
--- /dev/null
+++ b/Assets/Resources/Ending/earth_green.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:490c250116618b42db437cfe41b1f8a616d3392bd8faaab52a62006ca22c8fb5
+size 3272657
diff --git a/Assets/Resources/Ending/earth_green.png.meta b/Assets/Resources/Ending/earth_green.png.meta
new file mode 100644
index 0000000..c41dca1
--- /dev/null
+++ b/Assets/Resources/Ending/earth_green.png.meta
@@ -0,0 +1,132 @@
+fileFormatVersion: 2
+guid: d9a40abb906a7f745b7e54fd3b256c49
+TextureImporter:
+ internalIDToNameTable: []
+ externalObjects: {}
+ serializedVersion: 13
+ mipmaps:
+ mipMapMode: 0
+ enableMipMap: 1
+ sRGBTexture: 1
+ linearTexture: 0
+ fadeOut: 0
+ borderMipMap: 0
+ mipMapsPreserveCoverage: 0
+ alphaTestReferenceValue: 0.5
+ mipMapFadeDistanceStart: 1
+ mipMapFadeDistanceEnd: 3
+ bumpmap:
+ convertToNormalMap: 0
+ externalNormalMap: 0
+ heightScale: 0.25
+ normalMapFilter: 0
+ flipGreenChannel: 0
+ isReadable: 0
+ streamingMipmaps: 0
+ streamingMipmapsPriority: 0
+ vTOnly: 0
+ ignoreMipmapLimit: 0
+ grayScaleToAlpha: 0
+ generateCubemap: 6
+ cubemapConvolution: 0
+ seamlessCubemap: 0
+ textureFormat: 1
+ maxTextureSize: 2048
+ textureSettings:
+ serializedVersion: 2
+ filterMode: 1
+ aniso: 1
+ mipBias: 0
+ wrapU: 0
+ wrapV: 0
+ wrapW: 0
+ nPOTScale: 1
+ lightmap: 0
+ compressionQuality: 50
+ spriteMode: 0
+ spriteExtrude: 1
+ spriteMeshType: 1
+ alignment: 0
+ spritePivot: {x: 0.5, y: 0.5}
+ spritePixelsToUnits: 100
+ spriteBorder: {x: 0, y: 0, z: 0, w: 0}
+ spriteGenerateFallbackPhysicsShape: 1
+ alphaUsage: 1
+ alphaIsTransparency: 0
+ spriteTessellationMethod: 0
+ spriteTessellationDetail: -1
+ spriteGeometrySubdivision: -1
+ textureType: 0
+ textureShape: 1
+ singleChannelComponent: 0
+ flipbookRows: 1
+ flipbookColumns: 1
+ maxTextureSizeSet: 0
+ compressionQualitySet: 0
+ textureFormatSet: 0
+ ignorePngGamma: 0
+ applyGammaDecoding: 0
+ swizzle: 50462976
+ cookieLightType: 0
+ platformSettings:
+ - serializedVersion: 4
+ buildTarget: DefaultTexturePlatform
+ maxTextureSize: 2048
+ resizeAlgorithm: 0
+ textureFormat: -1
+ textureCompression: 1
+ compressionQuality: 50
+ crunchedCompression: 0
+ allowsAlphaSplitting: 0
+ overridden: 0
+ ignorePlatformSupport: 0
+ androidETC2FallbackOverride: 0
+ forceMaximumCompressionQuality_BC6H_BC7: 0
+ - serializedVersion: 4
+ buildTarget: Standalone
+ maxTextureSize: 2048
+ resizeAlgorithm: 0
+ textureFormat: -1
+ textureCompression: 1
+ compressionQuality: 50
+ crunchedCompression: 0
+ allowsAlphaSplitting: 0
+ overridden: 0
+ ignorePlatformSupport: 0
+ androidETC2FallbackOverride: 0
+ forceMaximumCompressionQuality_BC6H_BC7: 0
+ - serializedVersion: 4
+ buildTarget: WebGL
+ maxTextureSize: 2048
+ resizeAlgorithm: 0
+ textureFormat: -1
+ textureCompression: 1
+ compressionQuality: 50
+ crunchedCompression: 0
+ allowsAlphaSplitting: 0
+ overridden: 0
+ ignorePlatformSupport: 0
+ androidETC2FallbackOverride: 0
+ forceMaximumCompressionQuality_BC6H_BC7: 0
+ spriteSheet:
+ serializedVersion: 2
+ sprites: []
+ outline: []
+ customData:
+ physicsShape: []
+ bones: []
+ spriteID:
+ internalID: 0
+ vertices: []
+ indices:
+ edges: []
+ weights: []
+ secondaryTextures: []
+ spriteCustomMetadata:
+ entries: []
+ nameFileIdTable: {}
+ mipmapLimitGroupName:
+ pSDRemoveMatte: 0
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Resources/Loc/de.txt b/Assets/Resources/Loc/de.txt
index 6b27e7d..d255dd8 100644
--- a/Assets/Resources/Loc/de.txt
+++ b/Assets/Resources/Loc/de.txt
@@ -1016,3 +1016,32 @@ Lighting Beleuchtung
Classic Klassisch
Enhanced Verbessert
Enhanced: richer colour, warm light and cool shadows, deeper shade, and the world out of focus behind the phone and windows. Classic: the original look. Verbessert: sattere Farben, warmes Licht und kühle Schatten, tiefere Schattierung und eine unscharfe Welt hinter dem Handy und Fenstern. Klassisch: der ursprüngliche Look.
+100% MOWN ZU 100 % GEMÄHT
+EARTH ERDE
+Every blade. Cut, packed and shipped. Jeder Halm. Gemäht, gebündelt und verschickt.
+Earth has grass again. Die Erde hat wieder Gras.
+WHAT YOUR CREW DID WAS EURE CREW GESCHAFFT HAT
+Grass shipped to Earth Gras zur Erde verschickt
+Planet mown Planet gemäht
+Sectors mown clean Sektoren sauber gemäht
+Money earned Verdient
+Days on Herbaria-7 Tage auf Herbaria-7
+Robots at work Roboter im Einsatz
+Stations found Stationen gefunden
+Survey stakes sorted out Vermessungspflöcke entwirrt
+The crew: {0} Die Crew: {0}
+A game by Ein Spiel von
+Publisher Publisher
+Art Grafik
+Fonts Schriften
+Made with Erstellt mit
+Mission control Missionskontrolle
+And you Und ihr
+for every blade. für jeden Halm.
+We take grass very seriously. Wir nehmen Gras sehr ernst.
+THE END ENDE
+…unless? … oder etwa doch?
+HERBARIA-7 IS MOWN HERBARIA-7 IST GEMÄHT
+Earth has grass again. Thank you for mowing with us. Die Erde hat wieder Gras. Danke, dass ihr mit uns gemäht habt.
+The world is still yours: every machine, every belt, every robot. Die Welt gehört weiter euch: jede Maschine, jedes Band, jeder Roboter.
+LEAVE A REVIEW REZENSION SCHREIBEN
diff --git a/Assets/Resources/Loc/es.txt b/Assets/Resources/Loc/es.txt
index 1edc6d6..aa20049 100644
--- a/Assets/Resources/Loc/es.txt
+++ b/Assets/Resources/Loc/es.txt
@@ -1016,3 +1016,32 @@ Lighting Iluminación
Classic Clásica
Enhanced Mejorada
Enhanced: richer colour, warm light and cool shadows, deeper shade, and the world out of focus behind the phone and windows. Classic: the original look. Mejorada: colores más ricos, luz cálida y sombras frías, sombreado más profundo y el mundo desenfocado tras el móvil y las ventanas. Clásica: el aspecto original.
+100% MOWN SEGADA AL 100 %
+EARTH TIERRA
+Every blade. Cut, packed and shipped. Cada brizna. Segada, empacada y enviada.
+Earth has grass again. La Tierra vuelve a tener hierba.
+WHAT YOUR CREW DID LO QUE HIZO TU EQUIPO
+Grass shipped to Earth Hierba enviada a la Tierra
+Planet mown Planeta segado
+Sectors mown clean Sectores segados del todo
+Money earned Dinero ganado
+Days on Herbaria-7 Días en Herbaria-7
+Robots at work Robots trabajando
+Stations found Estaciones encontradas
+Survey stakes sorted out Estacas de medición desenredadas
+The crew: {0} El equipo: {0}
+A game by Un juego de
+Publisher Editor
+Art Arte
+Fonts Fuentes
+Made with Hecho con
+Mission control Control de misión
+And you Y tú
+for every blade. por cada brizna.
+We take grass very seriously. Nos tomamos la hierba muy en serio.
+THE END FIN
+…unless? … ¿o no?
+HERBARIA-7 IS MOWN HERBARIA-7 ESTÁ SEGADA
+Earth has grass again. Thank you for mowing with us. La Tierra vuelve a tener hierba. Gracias por segar con nosotros.
+The world is still yours: every machine, every belt, every robot. El mundo sigue siendo tuyo: cada máquina, cada cinta, cada robot.
+LEAVE A REVIEW ESCRIBIR UNA RESEÑA
diff --git a/Assets/Resources/Loc/fr.txt b/Assets/Resources/Loc/fr.txt
index 8fced54..9b77af2 100644
--- a/Assets/Resources/Loc/fr.txt
+++ b/Assets/Resources/Loc/fr.txt
@@ -1016,3 +1016,32 @@ Lighting Éclairage
Classic Classique
Enhanced Améliorée
Enhanced: richer colour, warm light and cool shadows, deeper shade, and the world out of focus behind the phone and windows. Classic: the original look. Améliorée : couleurs plus riches, lumière chaude et ombres froides, ombrage plus profond, et le monde flou derrière le téléphone et les fenêtres. Classique : le rendu d'origine.
+100% MOWN TONDUE À 100 %
+EARTH TERRE
+Every blade. Cut, packed and shipped. Chaque brin. Coupé, emballé et expédié.
+Earth has grass again. La Terre a de nouveau de l'herbe.
+WHAT YOUR CREW DID LE BILAN DE VOTRE ÉQUIPE
+Grass shipped to Earth Herbe expédiée sur Terre
+Planet mown Planète tondue
+Sectors mown clean Secteurs tondus à ras
+Money earned Argent gagné
+Days on Herbaria-7 Jours sur Herbaria-7
+Robots at work Robots au travail
+Stations found Stations trouvées
+Survey stakes sorted out Piquets de relevé démêlés
+The crew: {0} L'équipe : {0}
+A game by Un jeu de
+Publisher Éditeur
+Art Graphismes
+Fonts Polices
+Made with Réalisé avec
+Mission control Contrôle de mission
+And you Et vous
+for every blade. pour chaque brin.
+We take grass very seriously. Nous prenons l'herbe très au sérieux.
+THE END FIN
+…unless? … à moins que ?
+HERBARIA-7 IS MOWN HERBARIA-7 EST TONDUE
+Earth has grass again. Thank you for mowing with us. La Terre a de nouveau de l'herbe. Merci d'avoir tondu avec nous.
+The world is still yours: every machine, every belt, every robot. Le monde est toujours à vous : chaque machine, chaque tapis, chaque robot.
+LEAVE A REVIEW LAISSER UNE ÉVALUATION
diff --git a/Assets/Resources/Loc/it.txt b/Assets/Resources/Loc/it.txt
index 9d9d57c..04d6f51 100644
--- a/Assets/Resources/Loc/it.txt
+++ b/Assets/Resources/Loc/it.txt
@@ -1016,3 +1016,32 @@ Lighting Illuminazione
Classic Classica
Enhanced Migliorata
Enhanced: richer colour, warm light and cool shadows, deeper shade, and the world out of focus behind the phone and windows. Classic: the original look. Migliorata: colori più ricchi, luce calda e ombre fredde, ombreggiatura più profonda e il mondo sfocato dietro il telefono e le finestre. Classica: l'aspetto originale.
+100% MOWN FALCIATO AL 100%
+EARTH TERRA
+Every blade. Cut, packed and shipped. Ogni filo d'erba. Tagliato, impacchettato e spedito.
+Earth has grass again. La Terra ha di nuovo l'erba.
+WHAT YOUR CREW DID COSA HA FATTO LA TUA SQUADRA
+Grass shipped to Earth Erba spedita sulla Terra
+Planet mown Pianeta falciato
+Sectors mown clean Settori falciati del tutto
+Money earned Soldi guadagnati
+Days on Herbaria-7 Giorni su Herbaria-7
+Robots at work Robot al lavoro
+Stations found Stazioni trovate
+Survey stakes sorted out Picchetti di rilievo sbrogliati
+The crew: {0} La squadra: {0}
+A game by Un gioco di
+Publisher Editore
+Art Grafica
+Fonts Caratteri
+Made with Realizzato con
+Mission control Controllo missione
+And you E tu
+for every blade. per ogni filo d'erba.
+We take grass very seriously. Prendiamo l'erba molto sul serio.
+THE END FINE
+…unless? … oppure no?
+HERBARIA-7 IS MOWN HERBARIA-7 È FALCIATO
+Earth has grass again. Thank you for mowing with us. La Terra ha di nuovo l'erba. Grazie per aver falciato con noi.
+The world is still yours: every machine, every belt, every robot. Il mondo è ancora tuo: ogni macchina, ogni nastro, ogni robot.
+LEAVE A REVIEW SCRIVI UNA RECENSIONE
diff --git a/Assets/Resources/Loc/ja.txt b/Assets/Resources/Loc/ja.txt
index 60c8fa3..50ac38d 100644
--- a/Assets/Resources/Loc/ja.txt
+++ b/Assets/Resources/Loc/ja.txt
@@ -1016,3 +1016,32 @@ Lighting ライティング
Classic クラシック
Enhanced 強化
Enhanced: richer colour, warm light and cool shadows, deeper shade, and the world out of focus behind the phone and windows. Classic: the original look. 強化:豊かな色、暖かい光と涼しい影、深い陰影、スマホや画面を開くと背景がぼける。クラシック:元の見た目。
+100% MOWN 100% 刈り取り完了
+EARTH 地球
+Every blade. Cut, packed and shipped. 一本残らず。刈って、束ねて、送り出した。
+Earth has grass again. 地球に草が戻った。
+WHAT YOUR CREW DID クルーの成果
+Grass shipped to Earth 地球へ送った草
+Planet mown 刈った惑星
+Sectors mown clean 刈り尽くしたセクター
+Money earned 稼いだお金
+Days on Herbaria-7 Herbaria-7 での日数
+Robots at work 稼働中のロボット
+Stations found 見つけた基地
+Survey stakes sorted out ほどいた測量杭
+The crew: {0} クルー:{0}
+A game by 制作
+Publisher パブリッシャー
+Art アート
+Fonts フォント
+Made with 使用技術
+Mission control ミッション管制
+And you そして、あなた
+for every blade. 一本一本の草に感謝を。
+We take grass very seriously. 我々は草に本気だ。
+THE END 終わり
+…unless? ……それとも?
+HERBARIA-7 IS MOWN HERBARIA-7 刈り取り完了
+Earth has grass again. Thank you for mowing with us. 地球に草が戻った。一緒に刈ってくれてありがとう。
+The world is still yours: every machine, every belt, every robot. 世界はまだあなたのもの。すべての機械も、ベルトも、ロボットも。
+LEAVE A REVIEW レビューを書く
diff --git a/Assets/Resources/Loc/ko.txt b/Assets/Resources/Loc/ko.txt
index 5b00e36..f3237ba 100644
--- a/Assets/Resources/Loc/ko.txt
+++ b/Assets/Resources/Loc/ko.txt
@@ -1016,3 +1016,32 @@ Lighting 조명
Classic 클래식
Enhanced 향상
Enhanced: richer colour, warm light and cool shadows, deeper shade, and the world out of focus behind the phone and windows. Classic: the original look. 향상: 더 풍부한 색, 따뜻한 빛과 차가운 그림자, 깊은 음영, 휴대폰과 창 뒤의 흐린 배경. 클래식: 원래 모습.
+100% MOWN 100% 베기 완료
+EARTH 지구
+Every blade. Cut, packed and shipped. 풀 한 포기까지. 베고, 묶고, 보냈어요.
+Earth has grass again. 지구에 다시 풀이 자라요.
+WHAT YOUR CREW DID 크루가 해낸 일
+Grass shipped to Earth 지구로 보낸 풀
+Planet mown 깎은 행성
+Sectors mown clean 완전히 깎은 구역
+Money earned 번 돈
+Days on Herbaria-7 Herbaria-7에서 보낸 날
+Robots at work 일하는 로봇
+Stations found 찾은 기지
+Survey stakes sorted out 풀어 준 측량 말뚝
+The crew: {0} 크루: {0}
+A game by 제작
+Publisher 퍼블리셔
+Art 아트
+Fonts 글꼴
+Made with 사용 기술
+Mission control 임무 관제
+And you 그리고 당신
+for every blade. 풀 한 포기 한 포기에 감사를.
+We take grass very seriously. 우리는 풀에 아주 진지해요.
+THE END 끝
+…unless? …아니면?
+HERBARIA-7 IS MOWN HERBARIA-7 베기 완료
+Earth has grass again. Thank you for mowing with us. 지구에 다시 풀이 자라요. 함께 풀을 베어 줘서 고마워요.
+The world is still yours: every machine, every belt, every robot. 세상은 여전히 당신의 것이에요. 모든 기계, 모든 벨트, 모든 로봇까지.
+LEAVE A REVIEW 평가 작성
diff --git a/Assets/Resources/Loc/pl.txt b/Assets/Resources/Loc/pl.txt
index 9efd5d3..433dbc6 100644
--- a/Assets/Resources/Loc/pl.txt
+++ b/Assets/Resources/Loc/pl.txt
@@ -1016,3 +1016,32 @@ Lighting Oświetlenie
Classic Klasyczne
Enhanced Ulepszone
Enhanced: richer colour, warm light and cool shadows, deeper shade, and the world out of focus behind the phone and windows. Classic: the original look. Ulepszone: żywsze kolory, ciepłe światło i chłodne cienie, głębsze cieniowanie i rozmyty świat za telefonem i oknami. Klasyczne: pierwotny wygląd.
+100% MOWN SKOSZONA W 100%
+EARTH ZIEMIA
+Every blade. Cut, packed and shipped. Każde źdźbło. Skoszone, spakowane i wysłane.
+Earth has grass again. Ziemia znów ma trawę.
+WHAT YOUR CREW DID CO ZROBIŁA TWOJA EKIPA
+Grass shipped to Earth Trawy wysłanej na Ziemię
+Planet mown Skoszonej planety
+Sectors mown clean Sektorów skoszonych do czysta
+Money earned Zarobione pieniądze
+Days on Herbaria-7 Dni na Herbarii-7
+Robots at work Roboty w pracy
+Stations found Znalezione stacje
+Survey stakes sorted out Rozplątane paliki pomiarowe
+The crew: {0} Ekipa: {0}
+A game by Gra studia
+Publisher Wydawca
+Art Grafika
+Fonts Czcionki
+Made with Stworzone w
+Mission control Centrum dowodzenia
+And you I ty
+for every blade. za każde źdźbło.
+We take grass very seriously. Traktujemy trawę bardzo poważnie.
+THE END KONIEC
+…unless? … a może nie?
+HERBARIA-7 IS MOWN HERBARIA-7 SKOSZONA
+Earth has grass again. Thank you for mowing with us. Ziemia znów ma trawę. Dziękujemy, że kosiliście z nami.
+The world is still yours: every machine, every belt, every robot. Świat wciąż należy do was: każda maszyna, każda taśma, każdy robot.
+LEAVE A REVIEW NAPISZ RECENZJĘ
diff --git a/Assets/Resources/Loc/pt-BR.txt b/Assets/Resources/Loc/pt-BR.txt
index 094c53a..144f33a 100644
--- a/Assets/Resources/Loc/pt-BR.txt
+++ b/Assets/Resources/Loc/pt-BR.txt
@@ -1016,3 +1016,32 @@ Lighting Iluminação
Classic Clássica
Enhanced Aprimorada
Enhanced: richer colour, warm light and cool shadows, deeper shade, and the world out of focus behind the phone and windows. Classic: the original look. Aprimorada: cores mais ricas, luz quente e sombras frias, sombreamento mais profundo e o mundo desfocado atrás do celular e das janelas. Clássica: o visual original.
+100% MOWN 100% CORTADO
+EARTH TERRA
+Every blade. Cut, packed and shipped. Cada folha. Cortada, embalada e enviada.
+Earth has grass again. A Terra tem grama de novo.
+WHAT YOUR CREW DID O QUE SUA EQUIPE FEZ
+Grass shipped to Earth Grama enviada à Terra
+Planet mown Planeta cortado
+Sectors mown clean Setores cortados por inteiro
+Money earned Dinheiro ganho
+Days on Herbaria-7 Dias em Herbaria-7
+Robots at work Robôs trabalhando
+Stations found Estações encontradas
+Survey stakes sorted out Estacas de medição desenroladas
+The crew: {0} A equipe: {0}
+A game by Um jogo de
+Publisher Publicadora
+Art Arte
+Fonts Fontes
+Made with Feito com
+Mission control Controle da missão
+And you E você
+for every blade. por cada folha.
+We take grass very seriously. Levamos a grama muito a sério.
+THE END FIM
+…unless? … ou não?
+HERBARIA-7 IS MOWN HERBARIA-7 ESTÁ CORTADO
+Earth has grass again. Thank you for mowing with us. A Terra tem grama de novo. Obrigado por cortar com a gente.
+The world is still yours: every machine, every belt, every robot. O mundo continua seu: cada máquina, cada esteira, cada robô.
+LEAVE A REVIEW ESCREVER UMA ANÁLISE
diff --git a/Assets/Resources/Loc/ru.txt b/Assets/Resources/Loc/ru.txt
index 1cdfa0c..563d114 100644
--- a/Assets/Resources/Loc/ru.txt
+++ b/Assets/Resources/Loc/ru.txt
@@ -1016,3 +1016,32 @@ Lighting Освещение
Classic Классика
Enhanced Улучшенное
Enhanced: richer colour, warm light and cool shadows, deeper shade, and the world out of focus behind the phone and windows. Classic: the original look. Улучшенное: сочнее цвета, тёплый свет и холодные тени, глубже затенение, а мир размывается за телефоном и окнами. Классика: исходный вид.
+100% MOWN ВЫКОШЕНА НА 100%
+EARTH ЗЕМЛЯ
+Every blade. Cut, packed and shipped. Каждая травинка. Скошена, увязана и отправлена.
+Earth has grass again. На Земле снова есть трава.
+WHAT YOUR CREW DID ЧТО СДЕЛАЛА ВАША БРИГАДА
+Grass shipped to Earth Травы отправлено на Землю
+Planet mown Выкошено планеты
+Sectors mown clean Секторов выкошено начисто
+Money earned Заработано
+Days on Herbaria-7 Дней на Herbaria-7
+Robots at work Роботов в работе
+Stations found Найдено станций
+Survey stakes sorted out Распутано вешек
+The crew: {0} Бригада: {0}
+A game by Игра от
+Publisher Издатель
+Art Графика
+Fonts Шрифты
+Made with Сделано на
+Mission control Центр управления полётом
+And you И вы
+for every blade. за каждую травинку.
+We take grass very seriously. Мы относимся к траве очень серьёзно.
+THE END КОНЕЦ
+…unless? …или нет?
+HERBARIA-7 IS MOWN HERBARIA-7 ВЫКОШЕНА
+Earth has grass again. Thank you for mowing with us. На Земле снова есть трава. Спасибо, что косили с нами.
+The world is still yours: every machine, every belt, every robot. Мир по-прежнему ваш: все машины, все ленты, все роботы.
+LEAVE A REVIEW НАПИСАТЬ ОБЗОР
diff --git a/Assets/Resources/Loc/tr.txt b/Assets/Resources/Loc/tr.txt
index d8d30eb..77f1b08 100644
--- a/Assets/Resources/Loc/tr.txt
+++ b/Assets/Resources/Loc/tr.txt
@@ -1016,3 +1016,32 @@ Lighting Aydınlatma
Classic Klasik
Enhanced Gelişmiş
Enhanced: richer colour, warm light and cool shadows, deeper shade, and the world out of focus behind the phone and windows. Classic: the original look. Gelişmiş: daha zengin renkler, sıcak ışık ve soğuk gölgeler, daha derin gölgelendirme, telefon ve pencerelerin arkasında bulanık dünya. Klasik: orijinal görünüm.
+100% MOWN %100 BİÇİLDİ
+EARTH DÜNYA
+Every blade. Cut, packed and shipped. Her bir çim yaprağı. Biçildi, paketlendi ve gönderildi.
+Earth has grass again. Dünya'da yeniden çim var.
+WHAT YOUR CREW DID EKİBİNİN YAPTIKLARI
+Grass shipped to Earth Dünya'ya gönderilen çim
+Planet mown Biçilen gezegen
+Sectors mown clean Tamamen biçilen sektör
+Money earned Kazanılan para
+Days on Herbaria-7 Herbaria-7'de geçen gün
+Robots at work Çalışan robot
+Stations found Bulunan istasyon
+Survey stakes sorted out Çözülen ölçüm kazığı
+The crew: {0} Ekip: {0}
+A game by Yapımcı
+Publisher Yayıncı
+Art Görseller
+Fonts Yazı tipleri
+Made with Kullanılan teknolojiler
+Mission control Görev kontrol
+And you Ve sen
+for every blade. her bir çim yaprağı için.
+We take grass very seriously. Çimi çok ciddiye alırız.
+THE END SON
+…unless? … yoksa?
+HERBARIA-7 IS MOWN HERBARIA-7 BİÇİLDİ
+Earth has grass again. Thank you for mowing with us. Dünya'da yeniden çim var. Bizimle biçtiğin için teşekkürler.
+The world is still yours: every machine, every belt, every robot. Dünya hâlâ senin: her makine, her bant, her robot.
+LEAVE A REVIEW İNCELEME YAZ
diff --git a/Assets/Resources/Loc/zh-Hans.txt b/Assets/Resources/Loc/zh-Hans.txt
index 7110aba..f70afe3 100644
--- a/Assets/Resources/Loc/zh-Hans.txt
+++ b/Assets/Resources/Loc/zh-Hans.txt
@@ -1016,3 +1016,32 @@ Lighting 光照
Classic 经典
Enhanced 增强
Enhanced: richer colour, warm light and cool shadows, deeper shade, and the world out of focus behind the phone and windows. Classic: the original look. 增强:色彩更丰富,暖光冷影,阴影更深,打开手机和窗口时背景虚化。经典:原始画面。
+100% MOWN 已割完 100%
+EARTH 地球
+Every blade. Cut, packed and shipped. 每一片草叶。割下、打包、运走。
+Earth has grass again. 地球又有草了。
+WHAT YOUR CREW DID 你的队伍成就
+Grass shipped to Earth 运往地球的草
+Planet mown 星球已割
+Sectors mown clean 割干净的区块
+Money earned 赚到的钱
+Days on Herbaria-7 在 Herbaria-7 的天数
+Robots at work 工作中的机器人
+Stations found 找到的站点
+Survey stakes sorted out 理好的测量桩
+The crew: {0} 队伍:{0}
+A game by 开发
+Publisher 发行商
+Art 美术
+Fonts 字体
+Made with 制作工具
+Mission control 任务控制中心
+And you 还有你
+for every blade. 感谢每一片草叶。
+We take grass very seriously. 我们对草非常认真。
+THE END 完
+…unless? ……除非?
+HERBARIA-7 IS MOWN HERBARIA-7 已割完
+Earth has grass again. Thank you for mowing with us. 地球又有草了。感谢你和我们一起割草。
+The world is still yours: every machine, every belt, every robot. 世界依然属于你:每台机器、每条传送带、每个机器人。
+LEAVE A REVIEW 撰写评测
diff --git a/Assets/Scripts/Core/Achievements.cs b/Assets/Scripts/Core/Achievements.cs
index c41411f..ddf3be6 100644
--- a/Assets/Scripts/Core/Achievements.cs
+++ b/Assets/Scripts/Core/Achievements.cs
@@ -31,7 +31,7 @@ namespace GrassCutter
static float s_next;
static bool s_read;
- static bool Dev => CommandLine.Has("-autodemo") || CommandLine.Has("-mpdemo");
+ static bool Dev => CommandLine.Has("-autodemo") || CommandLine.Has("-mpdemo") || EndingCinematic.Preview;
static string Key => Dev ? "gc_awards_dev" : "gc_awards";
static Achievements()
@@ -107,7 +107,8 @@ namespace GrassCutter
PlayerPrefs.Save();
Hud.Toast(Loc.F("Achievement: {0}", a.name), Hud.ToastKind.Info);
Sfx.Play("milestone", 0.7f);
- if (SteamManager.Initialized)
+ // test runs earn them on this computer only, never on the player's Steam account
+ if (SteamManager.Initialized && !Dev)
{
SteamUserStats.SetAchievement(a.id);
SteamUserStats.StoreStats();
diff --git a/Assets/Scripts/Core/Cheats.cs b/Assets/Scripts/Core/Cheats.cs
index e6a30e8..8287cd7 100644
--- a/Assets/Scripts/Core/Cheats.cs
+++ b/Assets/Scripts/Core/Cheats.cs
@@ -52,6 +52,7 @@ namespace GrassCutter
Add("beer", "", "Drink a Grass Beer, no machine and no grass needed.", _ => { TreatHand.I?.Play(TreatId.Beer); return "Cheers."; });
Add("cigar", "", "Light a Herb Cigar, no machine and no grass needed.", _ => { TreatHand.I?.Play(TreatId.Cigar); return "Puff."; });
Add("ufo", "", "Bring a saucer down 30 m ahead of you.", _ => { Ts.ServerUfo(Me.transform.position + Me.transform.forward * 30f); return "They're coming."; });
+ Add("ending", "", "Play the ending film now (for you only).", _ => { EndingCinematic.Force = true; return "The planet is mown."; }, hostOnly: false);
Add("save", "", "Save the game now.", _ => { Ts.Save(); return "Saved."; });
Add("clear", "", "Clear the console.", _ => null, hostOnly: false);
}
diff --git a/Assets/Scripts/Core/DemoBot.Ending.cs b/Assets/Scripts/Core/DemoBot.Ending.cs
new file mode 100644
index 0000000..263c403
--- /dev/null
+++ b/Assets/Scripts/Core/DemoBot.Ending.cs
@@ -0,0 +1,125 @@
+using System.Collections;
+using System.Linq;
+using UnityEngine;
+
+namespace GrassCutter
+{
+ public partial class DemoBot
+ {
+ ///
+ /// -ending: a new world mown bald sector by sector until the planet goes past the line, and the ending that follows by
+ /// itself: the call, the climb, the planet, the results, the credits, THE END and the card; then back into the game,
+ /// and the film again from the cheat, skipped.
+ ///
+ IEnumerator EndingDemo()
+ {
+ TeamState.DeleteSave();
+ yield return new WaitForSeconds(2f);
+ NetSession.Instance.HostLocal();
+ while (!Me || !Ts) yield return null;
+ Clock(9.5f);
+ yield return new WaitForSeconds(9f);
+ Ts.ServerDeposit(48000f, CargoKind.Grass, Me.transform.position);
+ yield return Shot("end_00_before");
+
+ // every sector down, a slice a frame
+ float t0 = Time.realtimeSinceStartup;
+ for (int id = 0; id < HexGrid.Cells; id++)
+ {
+ MowMap.Close(id);
+ if (id % 4000 == 0) yield return null;
+ }
+ Log($"closed {HexGrid.Cells} sectors in {Time.realtimeSinceStartup - t0:0.0} s");
+ {
+ float fsum = 0f; double total = 0d; int empty = 0, done = 0;
+ foreach (var m in MowMap.All) { fsum += m.mown; total += m.total; if (m.total <= 0f) empty++; if (m.done) done++; }
+ Log($"mown {MowMap.MownArea():0} m² (float sum {fsum:0}), grass {total:0} m², planet {GameDefs.PlanetArea:0} m², sector {GameDefs.SectorArea:0.0} m², masks {MowMap.All.Count()} done {done} empty {empty}, finished {MowMap.Finished}");
+ }
+ float wait = Time.time;
+ while (!EndingCinematic.Running && Time.time - wait < 60f) yield return null;
+ Log($"ending started by itself: {EndingCinematic.Running}, planet {Ts.Mown01 * 100d:0.00000}%, seen before {EndingCinematic.Seen}");
+ if (!EndingCinematic.Running) { EndingCinematic.Force = true; while (!EndingCinematic.Running) yield return null; }
+
+ float s = Time.time;
+ yield return Until(s, 9f, "Call"); yield return Shot("end_01_call");
+ // the flights: skim, arc round the base, (a machine), the rise; times from the start of each stage
+ yield return AtStage("Climb", 2.5f, "end_02_skim");
+ yield return AtStage("Climb", 5.6f, "end_02b_skim_late");
+ yield return AtStage("Climb", 8.5f, "end_03_arc");
+ yield return AtStage("Climb", 12.5f, "end_03b_arc_late");
+ yield return AtStage("Space", 1.5f, "end_04a_rise_low");
+ yield return AtStage("Space", 5.5f, "end_04b_rise_mid");
+ yield return AtStage("Space", 8.5f, "end_04c_rise_high");
+ yield return AtStage("Space", 10.8f, "end_04d_rise_top");
+ yield return AtStage("Space", 14.0f, "end_05_title");
+ yield return AtStage("Space", 21.5f, "end_06_line");
+ yield return StageShot("Results", 5.5f, "end_07_results");
+ yield return AtStage("Earth", 0.5f, "end_08a_warp");
+ yield return AtStage("Earth", 5.0f, "end_08b_earth_title");
+ yield return AtStage("Earth", 8.7f, "end_08c_rocket_pass");
+ yield return AtStage("Earth", 9.7f, "end_08c2_rocket_away");
+ yield return AtStage("Earth", 12.5f, "end_08d_rocket_down");
+ yield return AtStage("Earth", 15.6f, "end_08e_landing");
+ yield return AtStage("Earth", 20f, "end_08f_greening");
+ yield return AtStage("Earth", 26f, "end_08g_line");
+ yield return AtStage("Earth", 33.5f, "end_08h_green");
+ yield return StageShot("Credits", 12f, "end_09_credits");
+ while (EndingCinematic.Stage != "End" && EndingCinematic.Running) yield return null;
+ yield return new WaitForSeconds(2.2f);
+ yield return Shot("end_10_theend");
+ yield return new WaitForSeconds(4.5f);
+ yield return Shot("end_10_card");
+ Log($"at the card: seen {EndingCinematic.Seen}, cinematic {Ctl.Cinematic}, modal {UIRoot.I.AnyModal}, {Time.time - s:0} s in");
+ UIRoot.I.CloseTopModal();
+ yield return new WaitForSeconds(1.5f);
+ Log($"keep mowing: running {EndingCinematic.Running}, cinematic {Ctl.Cinematic}, camera local {CameraFx.Cam.transform.localPosition}");
+ yield return Shot("end_11_back");
+
+ // again from the cheat, skipped a few seconds in
+ Cheats.Run("ending");
+ while (!EndingCinematic.Running) yield return null;
+ yield return new WaitForSeconds(4f);
+ EndingCinematic.SkipNow();
+ yield return new WaitForSeconds(7.5f);
+ yield return Shot("end_12_skipped");
+ Log($"skipped: stage {EndingCinematic.Stage}, modal {UIRoot.I.AnyModal}");
+ UIRoot.I.CloseTopModal();
+ yield return new WaitForSeconds(1f);
+ Log($"ending done: running {EndingCinematic.Running}, cinematic {Ctl.Cinematic}");
+ Application.Quit();
+ }
+
+ static IEnumerator Until(float since, float maxWait, string stage)
+ {
+ while (EndingCinematic.Stage != stage && Time.time - since < maxWait + 60f && EndingCinematic.Running) yield return null;
+ }
+
+ string _endStage;
+ float _endStageAt;
+
+ /// A picture this long after the film reached a stage (skipped when the film has moved past the stage).
+ IEnumerator AtStage(string stage, float at, string name)
+ {
+ while (EndingCinematic.Running)
+ {
+ var now = EndingCinematic.Stage;
+ if (now != _endStage) { _endStage = now; _endStageAt = Time.time; }
+ if (now == stage && Time.time - _endStageAt >= at) break;
+ if (now != stage && _seenStages.Contains(stage)) yield break;
+ if (now == stage) _seenStages.Add(stage);
+ yield return null;
+ }
+ if (!EndingCinematic.Running) yield break;
+ yield return Shot(name);
+ }
+
+ readonly System.Collections.Generic.HashSet _seenStages = new System.Collections.Generic.HashSet();
+
+ IEnumerator StageShot(string stage, float after, string name)
+ {
+ while (EndingCinematic.Stage != stage && EndingCinematic.Running) yield return null;
+ yield return new WaitForSeconds(after);
+ yield return Shot(name);
+ }
+ }
+}
diff --git a/Assets/Scripts/Core/DemoBot.Ending.cs.meta b/Assets/Scripts/Core/DemoBot.Ending.cs.meta
new file mode 100644
index 0000000..fe1f690
--- /dev/null
+++ b/Assets/Scripts/Core/DemoBot.Ending.cs.meta
@@ -0,0 +1,2 @@
+fileFormatVersion: 2
+guid: bab9c3d61fba2e147a3b0a62314efc20
\ No newline at end of file
diff --git a/Assets/Scripts/Core/DemoBot.Replica.cs b/Assets/Scripts/Core/DemoBot.Replica.cs
index 0acc738..6a2165b 100644
--- a/Assets/Scripts/Core/DemoBot.Replica.cs
+++ b/Assets/Scripts/Core/DemoBot.Replica.cs
@@ -43,7 +43,7 @@ namespace GrassCutter
var train = Train.All.Count > 0 ? Train.All[0] : null;
if (!train) { Log($"{me}: no train"); Application.Quit(); yield break; }
MowMap.Count();
- float mown0 = MowMap.MownArea();
+ double mown0 = MowMap.MownArea();
float at0 = train.At.Value;
yield return new WaitForSeconds(12f);
MowMap.Count();
diff --git a/Assets/Scripts/Core/DemoBot.cs b/Assets/Scripts/Core/DemoBot.cs
index 5aed988..b97b234 100644
--- a/Assets/Scripts/Core/DemoBot.cs
+++ b/Assets/Scripts/Core/DemoBot.cs
@@ -2879,7 +2879,7 @@ namespace GrassCutter
// the client takes the mower out: its strip must land on the host too
var rider = Vehicle.All.Find(v => v.kind == VehicleKind.Rider);
- float mownBefore = MowMap.MownArea();
+ double mownBefore = MowMap.MownArea();
if (!host && rider)
{
rider.Interact();
@@ -3086,6 +3086,11 @@ namespace GrassCutter
yield return gameObject.AddComponent().Shoot(folder);
yield break;
}
+ if (CommandLine.Has("-ending"))
+ {
+ yield return EndingDemo();
+ yield break;
+ }
if (CommandLine.Has("-demoend"))
{
yield return DemoEndDemo();
diff --git a/Assets/Scripts/Core/SaveSlots.cs b/Assets/Scripts/Core/SaveSlots.cs
index 2f18c5f..7720f12 100644
--- a/Assets/Scripts/Core/SaveSlots.cs
+++ b/Assets/Scripts/Core/SaveSlots.cs
@@ -69,7 +69,7 @@ namespace GrassCutter
return -1;
}
- static bool Dev => CommandLine.Has("-autodemo") || CommandLine.Has("-mpdemo");
+ static bool Dev => CommandLine.Has("-autodemo") || CommandLine.Has("-mpdemo") || EndingCinematic.Preview;
/// Without Steam (and in test runs) the slots sit straight in here.
static string Shared => Path.Combine(Application.persistentDataPath, Dev ? "saves_dev" : "saves");
static string _ready;
diff --git a/Assets/Scripts/Gameplay/TeamState.Sectors.cs b/Assets/Scripts/Gameplay/TeamState.Sectors.cs
index 361a331..9399ec1 100644
--- a/Assets/Scripts/Gameplay/TeamState.Sectors.cs
+++ b/Assets/Scripts/Gameplay/TeamState.Sectors.cs
@@ -38,6 +38,7 @@ namespace GrassCutter
if (id < 0 || id >= HexGrid.Cells || !MowMap.Claim(id)) return;
double pay = GameDefs.SectorBonus(Level(PerkId.RegionBonus)) * Crops.Pays(Crops.At(id));
Money.Value += pay;
+ Earned.Value += pay;
Closed.Value++;
SectorClosedRpc(id, pay);
}
@@ -49,11 +50,18 @@ namespace GrassCutter
SectorClosed?.Invoke(id, pay);
}
+ /// What the crew has mown; the whole planet once the last sector with grass on it is done.
+ static double MownNow()
+ {
+ double area = MowMap.MownArea();
+ return MowMap.Left == 0 ? GameDefs.PlanetArea : System.Math.Min(area, GameDefs.PlanetArea * 0.99998d);
+ }
+
void TickSectors()
{
if (Time.time < _mownAt) return;
_mownAt = Time.time + 1f;
- Mown.Value = MowMap.MownArea();
+ Mown.Value = MownNow();
}
// ───────────────────────── stakes & survey points ─────────────────────────
@@ -67,6 +75,7 @@ namespace GrassCutter
double pay = Landmarks.Pay(id);
Found.Add(id);
Money.Value += pay;
+ Earned.Value += pay;
MarkFoundRpc(who.DisplayName, id, pay);
}
diff --git a/Assets/Scripts/Gameplay/TeamState.Weather.cs b/Assets/Scripts/Gameplay/TeamState.Weather.cs
index 190342f..6152971 100644
--- a/Assets/Scripts/Gameplay/TeamState.Weather.cs
+++ b/Assets/Scripts/Gameplay/TeamState.Weather.cs
@@ -202,6 +202,7 @@ namespace GrassCutter
_ufoPaid = true;
double tip = System.Math.Round(System.Math.Max(150d, Shipped.Value * 0.03d));
Money.Value += tip;
+ Earned.Value += tip;
AnnounceRpc(Loc.Pack("The visitors liked the meadow: they left {0} by their crop circle.", UIK.Money(tip)));
}
diff --git a/Assets/Scripts/Gameplay/TeamState.cs b/Assets/Scripts/Gameplay/TeamState.cs
index a832e11..7a3f0cf 100644
--- a/Assets/Scripts/Gameplay/TeamState.cs
+++ b/Assets/Scripts/Gameplay/TeamState.cs
@@ -20,6 +20,10 @@ namespace GrassCutter
public readonly NetworkVariable Mown = new NetworkVariable();
/// Sectors mown clean.
public readonly NetworkVariable Closed = new NetworkVariable();
+ /// Every coin the crew has ever been paid (grass, sectors, stakes, tips), spent or not.
+ public readonly NetworkVariable Earned = new NetworkVariable();
+ /// Seconds this world has been running, over every session.
+ public readonly NetworkVariable Played = new NetworkVariable();
public NetworkList Perks;
public NetworkList Tiles;
/// Stakes and survey points the crew has done.
@@ -49,6 +53,8 @@ namespace GrassCutter
/// Which set of planet sizes (): 0 for every save from before.
public int sizeGen;
public double money, shipped, mown;
+ /// All money ever paid in, and seconds played (0 in saves from before they were counted).
+ public double earned, played;
/// Time of day: the first morning begins here.
public float day = 0.75f;
public int[] perks;
@@ -130,6 +136,8 @@ namespace GrassCutter
}
public double Mown01 => Mown.Value / GameDefs.PlanetArea;
+ /// Whole days (sunrise to sunrise) this world has run.
+ public int Days => (int)(Played.Value / GameDefs.DayLength);
public float ToolCap(ToolId t) => GameDefs.IsBlade(t) ? GameDefs.ToolCap(t, GameDefs.HasBinPerk(t) ? Level(GameDefs.BinPerk(t)) : 0, Level(PerkId.Compactor)) : 0f;
@@ -171,6 +179,7 @@ namespace GrassCutter
if (!IsServer || kg <= 0f) return 0d;
double pay = kg * GameDefs.PerKg(kind) * PayoutMul;
Money.Value += pay;
+ Earned.Value += pay;
Shipped.Value += kg;
DepositedRpc(at, pay, kg);
return pay;
@@ -318,6 +327,7 @@ namespace GrassCutter
void Update()
{
if (!IsServer || !IsSpawned) return;
+ Played.Value += Time.unscaledDeltaTime;
TickSectors();
TickWeather();
_powerTimer += Time.deltaTime;
@@ -340,7 +350,7 @@ namespace GrassCutter
public void Save()
{
if (!IsServer) return;
- var d = new SaveData { ver = 6, level = (int)Difficulties.Current, sizeGen = Difficulties.Gen, money = Money.Value, shipped = Shipped.Value, mown = Mown.Value, crew = _crew, day = Sun.Phase, vehicles = PackVehicles(), banned = _banned };
+ var d = new SaveData { ver = 6, level = (int)Difficulties.Current, sizeGen = Difficulties.Gen, money = Money.Value, shipped = Shipped.Value, mown = Mown.Value, earned = Earned.Value, played = Played.Value, crew = _crew, day = Sun.Phase, vehicles = PackVehicles(), banned = _banned };
d.perks = new int[Perks.Count];
for (int i = 0; i < Perks.Count; i++) d.perks[i] = Perks[i];
d.tiles = new int[Tiles.Count];
@@ -377,8 +387,11 @@ namespace GrassCutter
if (!fresh) LoadMow();
Money.Value = d.money;
Shipped.Value = d.shipped;
+ // saves from before the crew's pay was counted start from what they have shipped
+ Earned.Value = d.earned > 0d ? d.earned : d.money;
+ Played.Value = d.played;
ServerSetPhase(d.day);
- Mown.Value = MowMap.MownArea();
+ Mown.Value = MownNow();
MowMap.Count();
Closed.Value = MowMap.Finished;
if (d.found != null) foreach (int id in d.found) Found.Add(id);
diff --git a/Assets/Scripts/UI/DirectorCall.cs b/Assets/Scripts/UI/DirectorCall.cs
index d02d43c..2ff42cb 100644
--- a/Assets/Scripts/UI/DirectorCall.cs
+++ b/Assets/Scripts/UI/DirectorCall.cs
@@ -65,6 +65,8 @@ namespace GrassCutter
/// Rings with this line. Calls wait their turn.
/// The trailer: no calls but the ones it asks for.
public static bool Quiet;
+ /// A call is over: which line, and whether V put the phone away before he finished.
+ public static event Action Ended;
public static void Call(string line)
{
@@ -73,6 +75,12 @@ namespace GrassCutter
I._queue.Enqueue(line);
}
+ /// Forgets every call still waiting to ring (the one on the line goes on).
+ public static void Drop()
+ {
+ if (I) I._queue.Clear();
+ }
+
/// The opening film plays the call itself: no ring, the phone already up.
public static IEnumerator Speak(string line, bool hangUp)
{
@@ -178,6 +186,7 @@ namespace GrassCutter
}
_view?.Show(false);
_on = false;
+ Ended?.Invoke(line, hungUp);
}
/// The jaw follows how loud he is, quick to open and a little slower to shut.
@@ -358,7 +367,8 @@ namespace GrassCutter
return;
}
foreach (var (at, line) in Milestones)
- if (_mown < at && mown >= at) Call(line);
+ // the last one is the ending's: it plays the call inside its own film
+ if (_mown < at && mown >= at && line != "dir_m100") Call(line);
if (machine && !_machine) Call("dir_machine");
if (combine && !_combine) Call("dir_combine");
if (drones && !_drones) Call("dir_drones");
diff --git a/Assets/Scripts/UI/EndingCinematic.cs b/Assets/Scripts/UI/EndingCinematic.cs
new file mode 100644
index 0000000..0385d56
--- /dev/null
+++ b/Assets/Scripts/UI/EndingCinematic.cs
@@ -0,0 +1,825 @@
+using System.Collections;
+using System.Collections.Generic;
+using System.Linq;
+using UnityEngine;
+using UnityEngine.InputSystem;
+using UnityEngine.UIElements;
+
+namespace GrassCutter
+{
+ ///
+ /// The end of the game: the last blade on Herbaria-7 is down. A beat, the phone rings, and the Director, voice breaking,
+ /// tells the crew they did it. The phone goes down and the cuts climb away from the bare ground, slower than the opening
+ /// film's, until the planet hangs in space, mown bald. Over it: the title, a line, what the crew did. Then a jump across space
+ /// to where the grass went: Earth, scorched and dried out. A rocket from Herbaria-7 comes past the lens and down onto it, the
+ /// green spreads from where it lands over the whole ball, and the credits roll up past it, THE END… and a card to go on
+ /// mowing, leave a review or go back to the menu. Space, Enter or
+ /// Esc jumps to that card. Every player in the session sees it at once on their own screen; it plays once per world, when
+ /// the planet goes past while you are in it (the cheat "ending" plays it again).
+ ///
+ [DefaultExecutionOrder(10000)]
+ public class EndingCinematic : MonoBehaviour
+ {
+ const string SeenKey = "gc_ending_seen";
+ /// The planet counts as mown from here, the same line as the Director's last milestone.
+ public const double Done = 0.99999d;
+ public const string ReviewUrl = "https://store.steampowered.com/recommended/recommendgame/5551720";
+
+ /// This computer has watched the ending at least once.
+ public static bool Seen => PlayerPrefs.GetInt(SeenKey, 0) == 1;
+ public static bool Running { get; private set; }
+ /// The cheat and the dev bot: play it now, whatever the planet says.
+ public static bool Force;
+ /// Where the film is, for the dev bot's pictures.
+ public static string Stage => Running ? I._phase.ToString() : "";
+ static EndingCinematic I;
+
+ // who made it: roles and names, in the order they roll (roles go through Loc, names never do)
+ static readonly (string role, string[] names)[] Credits =
+ {
+ (Loc.N("A game by"), new[] { "Exbyte Studios" }),
+ (Loc.N("Publisher"), new[] { "PlayWay" }),
+ (Loc.N("Art"), new[] { "POLYGON art by Synty Studios" }),
+ (Loc.N("Fonts"), new[] { "Lilita One by Juan Montoreano", "Nunito by the Nunito Project Authors", "Noto Sans CJK by Google and Adobe" }),
+ (Loc.N("Made with"), new[] { "Unity", "Netcode for GameObjects", "Steamworks.NET" }),
+ (Loc.N("Mission control"), new[] { "G.R.A.S.S.A." }),
+ };
+
+ enum Phase { None, Call, Climb, Space, Results, Earth, Credits, End }
+ enum Shot { None, Path, Rise, Orbit, Earth }
+
+ Phase _phase;
+ Shot _shot;
+ Coroutine _run;
+ float _near = 0.05f, _far = 14000f;
+ // the orbit: round the ball's centre about an axis, the ball easing off to one side of the frame
+ Vector3 _orbitFrom, _orbitAxis;
+ float _orbitAngle, _orbitSpeed, _orbitDist, _shift, _shiftTo;
+
+ // what the watcher saw last
+ bool _seeded, _due;
+ float _seedAt = -1f;
+ double _mown;
+
+ VisualElement _layer, _black, _top, _bottom, _titleBox, _stats, _creditsBox, _flash;
+ // Earth, and the lens round it: how far round from the sun (degrees) and how far out
+ EndingEarth _earth;
+ float _eTheta, _eDist, _eDistTo, _warp;
+ Label _ring, _title, _sub, _line, _skip, _theEnd, _unless;
+ VisualElement _cardLayer;
+
+ ///
+ /// "-ending" on the command line (without a test bot): straight into a test world of its own, every sector mown, and
+ /// the ending as a player gets it. Saves and awards go to the dev folders, never the player's.
+ ///
+ public static bool Preview => CommandLine.Has("-ending") && !CommandLine.Has("-autodemo");
+
+ void Awake() => I = this;
+
+ void Start()
+ {
+ if (Preview) StartCoroutine(MowForPreview());
+ }
+
+ IEnumerator MowForPreview()
+ {
+ // from the menu, as the test bots start: a fresh test world of its own (never the player's slots)
+ yield return new WaitForSeconds(2f);
+ TeamState.DeleteSave();
+ NetSession.Instance.HostLocal();
+ while (!TeamState.Instance || !TeamState.Instance.IsSpawned || !PlayerAgent.Local || !PlayerAgent.Local.IsSpawned) yield return null;
+ yield return new WaitForSeconds(4f);
+ var ts = TeamState.Instance;
+ if (!ts.IsServer) yield break;
+ // the milestones on the way would ring first and keep the ending waiting
+ DirectorCall.Quiet = true;
+ ts.ServerDeposit(48000f, CargoKind.Grass, PlayerAgent.Local.transform.position);
+ for (int id = 0; id < HexGrid.Cells; id++)
+ {
+ MowMap.Close(id);
+ if (id % 4000 == 0) yield return null;
+ }
+ }
+
+ /// The dev bot's Space: straight to THE END and the card.
+ public static void SkipNow()
+ {
+ if (I && Running && I._phase != Phase.End) I.SkipToEnd();
+ }
+
+ static readonly int BaldId = Shader.PropertyToID("_GcBald");
+ float _bald = -1f;
+
+ void Update()
+ {
+ Watch();
+ // the far meadow turns to stubble once the planet is mown, and in the film whatever the planet says
+ var tsb = TeamState.Instance;
+ float bald = Running || (tsb && tsb.IsSpawned && tsb.Mown01 >= Done) ? 1f : 0f;
+ if (bald != _bald) { _bald = bald; Shader.SetGlobalFloat(BaldId, bald); }
+ // calls still waiting (a lesser milestone passed on the way) would be stale after it: they go
+ if (_due) DirectorCall.Drop();
+ if (_due && !Running && Ready()) { _due = false; _run = StartCoroutine(Run()); }
+ if (!Running) return;
+ var k = Keyboard.current;
+ bool skip = k != null && (k.spaceKey.wasPressedThisFrame || k.enterKey.wasPressedThisFrame || k.escapeKey.wasPressedThisFrame);
+ if (skip && _phase != Phase.End) SkipToEnd();
+ // the card is shut (its button, or Esc through the modal stack): back to the game
+ if (_phase == Phase.End && _cardLayer != null && _cardLayer.pickingMode == PickingMode.Ignore) Finish();
+ }
+
+ /// The planet going past the line while you are in the world; a save that loads already mown doesn't count.
+ void Watch()
+ {
+ var ts = TeamState.Instance;
+ var me = PlayerAgent.Local;
+ if (!ts || !ts.IsSpawned || !me || !me.IsSpawned) { _seeded = false; _seedAt = -1f; _due = false; if (Running) Finish(); return; }
+ if (Force) { Force = false; _due = true; }
+ if (Demo.On) return;
+ if (_seedAt < 0f) _seedAt = Time.time + 6f;
+ double mown = ts.Mown01;
+ if (!_seeded)
+ {
+ if (Time.time < _seedAt) return;
+ _seeded = true;
+ _mown = mown;
+ return;
+ }
+ if (_mown < Done && mown >= Done) _due = true;
+ _mown = mown;
+ }
+
+ /// Not over the opening film, a call or a menu.
+ static bool Ready() => !IntroCinematic.Running && !Ctl.Cinematic && !DirectorCall.Busy && !Ctl.UIOpen && Phone.I && UIRoot.I;
+
+ // ───────── the film ─────────
+
+ IEnumerator Run()
+ {
+ Running = true;
+ _phase = Phase.Call;
+ Ctl.Cinematic = true;
+ UIRoot.I.HideHud(true);
+ Build();
+
+ // 1. a breath: the last blade is down, eyes out to the horizon. Then the phone.
+ var me0 = PlayerAgent.Local;
+ if (me0)
+ {
+ var up0 = Planet.Up(me0.transform.position);
+ var f0 = Vector3.ProjectOnPlane(me0.transform.forward, up0).normalized;
+ if (f0.sqrMagnitude > 0.01f) me0.LookAt(Planet.Surface(me0.transform.position + f0 * 60f) + up0 * 1.5f);
+ }
+ Sfx.Play("milestone", 0.8f, 1f, 0f);
+ yield return new WaitForSeconds(1.8f);
+ _ring.style.display = DisplayStyle.Flex;
+ UIK.PopIn(_ring, 0f, 0.3f);
+ for (int i = 0; i < 2; i++)
+ {
+ Sfx.Play("phone_ring", 0.5f, 1f, 0f);
+ UIK.Punch(_ring, 0.12f);
+ yield return new WaitForSeconds(1.5f);
+ }
+ _ring.style.display = DisplayStyle.None;
+ Phone.I?.Show(PhoneMode.Up);
+ yield return new WaitForSeconds(0.7f);
+ yield return DirectorCall.Speak("dir_m100", true);
+ Phone.I?.Show(PhoneMode.Away);
+ yield return new WaitForSeconds(0.5f);
+
+ // 2. flights: skimming the stubble in to the base, round the base, past a machine at work, then one long rise
+ // from the ground into space that turns into the slow orbit of the ball
+ _phase = Phase.Climb;
+ Sfx.Music("music_menu_loop", 3f);
+ Bars(true);
+ GrassField.FurReach = 3.5f;
+ var home = Planet.OnSurface(Vector3.up);
+ var up = Planet.Up(home);
+ var cam = CameraFx.Cam;
+ var look0 = cam ? Vector3.ProjectOnPlane(cam.transform.forward, up) : Vector3.forward;
+ var d = ClearHeading(home, look0.sqrMagnitude > 0.01f ? look0.normalized : Vector3.ProjectOnPlane(Vector3.forward, up).normalized);
+ var side = Vector3.Cross(up, d);
+
+ // skim: a metre and a half over the stubble, fast, straight in at the base and up over its rail
+ {
+ float[] at = { 135f, 100f, 66f, 36f, 15f };
+ float[] h = { 1.5f, 1.3f, 1.5f, 3.2f, 8.5f };
+ var eyes = new Vector3[at.Length];
+ var looks = new Vector3[at.Length];
+ for (int i = 0; i < at.Length; i++)
+ {
+ eyes[i] = Ground(home + d * at[i] + side * Mathf.Sin(i * 0.9f) * 3f, h[i]);
+ looks[i] = i >= at.Length - 2 ? home + up * (i == at.Length - 1 ? 1f : 4f) : Ground(home + d * (at[i] - 45f), 1.6f);
+ }
+ Sfx.Play("cut_whoosh_1", 0.32f, 0.85f, 0f);
+ yield return Fly(eyes, looks, 6.2f);
+ }
+
+ // past a machine or a robot near the base, if the crew has one
+ if (Worker(home, out var wPos, out var wFwd))
+ {
+ var wUp = Planet.Up(wPos);
+ var wSide = Vector3.Cross(wUp, wFwd);
+ var eyes = new[] { Ground(wPos - wFwd * 14f + wSide * 7f, 2.2f), Ground(wPos - wFwd * 2f + wSide * 6f, 1.8f), Ground(wPos + wFwd * 11f + wSide * 5f, 2.4f) };
+ var looks = new[] { wPos + wUp * 1f, wPos + wUp * 1f, wPos + wUp * 1.2f };
+ Sfx.Play("cut_whoosh_2", 0.3f, 0.95f, 0f);
+ yield return Fly(eyes, looks, 5f);
+ }
+
+ // round the base, close, over the roofs, half way round it
+ Vector3 arcEnd;
+ {
+ var c = home + up * 2.5f;
+ int n = 7;
+ var eyes = new Vector3[n];
+ var looks = new Vector3[n];
+ for (int i = 0; i < n; i++)
+ {
+ var r = Quaternion.AngleAxis(-20f + i * 30f, up) * d;
+ eyes[i] = Ground(home + r * (26f - i * 0.6f), 9.5f + i * 0.9f);
+ looks[i] = c;
+ }
+ arcEnd = eyes[n - 1];
+ yield return Fly(eyes, looks, 8f);
+ }
+
+ // the rise: on from where the arc left off, straight up over the base, then out, without a cut, into the orbit
+ _phase = Phase.Space;
+ OrbitSetup(Planet.Up(arcEnd), side);
+ Sfx.Play("space_rumble", 0.8f, 1f, 0f);
+ Sfx.Play("cut_whoosh_2", 0.35f, 0.7f, 0f);
+ yield return Rise(arcEnd, home + up * 2.5f, 12f);
+ _shot = Shot.Orbit;
+ yield return new WaitForSeconds(1.2f);
+ _title.text = Loc.T("HERBARIA-7");
+ _sub.text = Loc.T("100% MOWN");
+ _sub.style.display = DisplayStyle.Flex;
+ Show(_titleBox, 1.4f);
+ UIK.PopIn(_title, 0f, 0.6f);
+ yield return new WaitForSeconds(4.6f);
+ Hide(_titleBox, 1.2f);
+ yield return new WaitForSeconds(1.4f);
+ _line.text = Loc.T("Every blade. Cut, packed and shipped.");
+ Show(_line, 0.9f);
+ yield return new WaitForSeconds(3.4f);
+ Hide(_line, 0.9f);
+ yield return new WaitForSeconds(1.1f);
+
+ // 4. what the crew did, the ball easing off to the right
+ _phase = Phase.Results;
+ _shiftTo = 1f;
+ yield return new WaitForSeconds(0.8f);
+ FillStats(true);
+ yield return new WaitForSeconds(9.5f);
+ Hide(_stats, 1.2f);
+ _shiftTo = 0f;
+ yield return new WaitForSeconds(1.4f);
+
+ // 5. a jump across space to where the grass went: Earth, scorched and dry
+ _phase = Phase.Earth;
+ yield return Warp();
+ yield return new WaitForSeconds(1.4f);
+ _title.text = Loc.T("EARTH");
+ _sub.style.display = DisplayStyle.None;
+ Show(_titleBox, 1.4f);
+ UIK.PopIn(_title, 0f, 0.6f);
+ yield return new WaitForSeconds(3.6f);
+ Hide(_titleBox, 1.2f);
+ yield return new WaitForSeconds(1.0f);
+
+ // 6. the rocket from Herbaria-7 past the lens and down onto it, and the green spreading from where it lands
+ yield return _earth.Rocket(EarthPose, LandingPlace, 7f);
+ float greenT = 0f;
+ bool said = false;
+ while (!_earth.Healed && greenT < 25f)
+ {
+ greenT += Time.deltaTime;
+ if (!said && greenT > 9f)
+ {
+ said = true;
+ _line.text = Loc.T("Earth has grass again.");
+ Show(_line, 0.9f);
+ }
+ yield return null;
+ }
+ yield return new WaitForSeconds(2.5f);
+ if (said) Hide(_line, 0.9f);
+ yield return new WaitForSeconds(1.2f);
+
+ // 7. the credits roll up past it, the ball easing off to the right
+ _phase = Phase.Credits;
+ _shiftTo = 1f;
+ yield return new WaitForSeconds(0.8f);
+ yield return RollCredits(32f);
+
+ // 8. THE END… and the card
+ yield return End();
+ }
+
+ /// The screen goes white while the lens falls away from the ball; it comes back on Earth.
+ IEnumerator Warp()
+ {
+ Sfx.Play("meteor_whoosh", 0.7f, 0.7f, 0f);
+ Sfx.Play("cut_whoosh_2", 0.5f, 0.6f, 0f);
+ _flash.style.display = DisplayStyle.Flex;
+ float t = 0f;
+ while (t < 0.7f)
+ {
+ t += Time.deltaTime;
+ float k = Mathf.Clamp01(t / 0.7f);
+ _warp = k * k;
+ _flash.style.opacity = k * k;
+ yield return null;
+ }
+ _flash.style.opacity = 1f;
+ EarthSetup();
+ _warp = 0f;
+ yield return null;
+ Sfx.Play("space_rumble", 0.6f, 0.8f, 0f);
+ t = 0f;
+ while (t < 1.3f)
+ {
+ t += Time.deltaTime;
+ _flash.style.opacity = 1f - Mathf.SmoothStep(0f, 1f, t / 1.3f);
+ yield return null;
+ }
+ _flash.style.display = DisplayStyle.None;
+ }
+
+ /// Earth made (once) and the lens out in front of it, stars round the new spot.
+ void EarthSetup()
+ {
+ if (_earth == null)
+ {
+ var sun = Sun.Dir.sqrMagnitude > 0.01f ? Sun.Dir.normalized : Vector3.up;
+ _earth = new EndingEarth(Planet.Center, sun);
+ _eTheta = 58f;
+ _eDist = EndingEarth.R * 3.0f;
+ _eDistTo = EndingEarth.R * 2.3f;
+ // Africa under the rocket when it comes down (about 15 s on), Europe and the Middle East up round it
+ _earth.Face(LandingPlace, EarthLanding(), 15f);
+ }
+ _shift = _shiftTo = 0f;
+ _shot = Shot.Earth;
+ _near = 1f;
+ _far = 60000f;
+ SpaceSky.Set(false, Vector3.zero);
+ SpaceSky.Set(true, EarthEye());
+ }
+
+ static readonly Vector3 LandingPlace = EndingEarth.Geo(12f, 18f);
+
+ Vector3 EarthView()
+ {
+ float th = _eTheta * Mathf.Deg2Rad;
+ return (_earth.Sun * Mathf.Cos(th) + _earth.Side * Mathf.Sin(th)).normalized;
+ }
+
+ Vector3 EarthEye() => _earth.Center + EarthView() * EarthDist();
+
+ // further out while the ball sits off to one side, so it stays round at the edge of the frame
+ float EarthDist() => _eDist + EndingEarth.R * 0.9f * _shift;
+
+ /// Where the lens is round Earth this frame, and which way it looks.
+ Pose EarthPose()
+ {
+ var v = EarthView();
+ var e = _earth.Center + v * EarthDist();
+ var right = Vector3.Cross(_earth.Up, -v).normalized;
+ var look = _earth.Center - right * EndingEarth.R * 1.15f * _shift;
+ return new Pose(e, Quaternion.LookRotation(look - e, _earth.Up));
+ }
+
+ /// Where the rocket comes down: on the face we see, up a little and towards the sun.
+ Vector3 EarthLanding() => (EarthView() * 0.9f + _earth.Up * 0.32f + _earth.Sun * 0.22f).normalized;
+
+ /// A point this high over the ground under p.
+ static Vector3 Ground(Vector3 p, float h)
+ {
+ var g = Planet.Surface(p);
+ return g + Planet.Up(g) * h;
+ }
+
+ /// The way out from the base with a clear run along the ground, starting from the one given.
+ static Vector3 ClearHeading(Vector3 home, Vector3 prefer)
+ {
+ var up = Planet.Up(home);
+ for (int k = 0; k < 8; k++)
+ {
+ var d = Quaternion.AngleAxis(k * 45f, up) * prefer;
+ if (!Physics.Linecast(Ground(home + d * 180f, 1.5f), Ground(home + d * 60f, 2.5f)) && !Physics.Linecast(Ground(home + d * 60f, 4.5f), home + up * 6f))
+ return d;
+ }
+ return prefer;
+ }
+
+ /// The crew's machine or robot nearest the base (within reach of a flight), and which way it faces.
+ static bool Worker(Vector3 home, out Vector3 pos, out Vector3 fwd)
+ {
+ pos = fwd = Vector3.zero;
+ float best = 600f * 600f;
+ Transform pick = null;
+ foreach (var v in Vehicle.All) if (v && (v.transform.position - home).sqrMagnitude < best) { best = (v.transform.position - home).sqrMagnitude; pick = v.transform; }
+ if (!pick) foreach (var m in Mowbot.All) if (m && (m.transform.position - home).sqrMagnitude < best) { best = (m.transform.position - home).sqrMagnitude; pick = m.transform; }
+ if (!pick) return false;
+ pos = pick.position;
+ var up = Planet.Up(pos);
+ fwd = Vector3.ProjectOnPlane(pick.forward, up).normalized;
+ if (fwd.sqrMagnitude < 0.01f) fwd = Vector3.ProjectOnPlane(Vector3.forward, up).normalized;
+ return true;
+ }
+
+ // a flight along a smooth curve through the eyes, looking along a smooth curve through the looks
+ Vector3[] _pathEyes, _pathLooks;
+ float _pathT, _pathFor;
+ // the rise: from an eye over the ground out to the orbit's first spot
+ Vector3 _riseFrom, _riseLook, _riseTop;
+ float _riseAlt0;
+
+ IEnumerator Fly(Vector3[] eyes, Vector3[] looks, float seconds)
+ {
+ _pathEyes = eyes; _pathLooks = looks;
+ _pathT = 0f; _pathFor = seconds;
+ _shot = Shot.Path;
+ _near = 0.05f; _far = 14000f;
+ while (_pathT < _pathFor) yield return null;
+ }
+
+ IEnumerator Rise(Vector3 from, Vector3 look, float seconds)
+ {
+ _riseFrom = from; _riseLook = look;
+ // the top of the frame while the lens looks down: the way from the start to the base, fixed in the world, so it
+ // never flips when the eye passes over the base
+ _riseTop = Vector3.ProjectOnPlane(look - from, Planet.Up(from)).normalized;
+ _riseAlt0 = Mathf.Max(1f, Planet.Altitude(from));
+ _pathT = 0f; _pathFor = seconds;
+ _shot = Shot.Rise;
+ while (_pathT < _pathFor) yield return null;
+ }
+
+ static Vector3 Spline(Vector3[] p, float u)
+ {
+ int n = p.Length;
+ if (n == 1) return p[0];
+ u = Mathf.Clamp(u, 0f, n - 1.0001f);
+ int i = (int)u;
+ float t = u - i;
+ var p0 = p[Mathf.Max(0, i - 1)];
+ var p1 = p[i];
+ var p2 = p[Mathf.Min(n - 1, i + 1)];
+ var p3 = p[Mathf.Min(n - 1, i + 2)];
+ return 0.5f * (2f * p1 + (p2 - p0) * t + (2f * p0 - 5f * p1 + 4f * p2 - p3) * t * t + (3f * p1 - p0 - 3f * p2 + p3) * t * t * t);
+ }
+
+ IEnumerator RollCredits(float seconds)
+ {
+ FillCredits();
+ _creditsBox.style.opacity = 1f;
+ _creditsBox.style.display = DisplayStyle.Flex;
+ // one frame for it to lay out, then it climbs from under the screen to over the top
+ _creditsBox.style.translate = new Translate(0f, 4000f);
+ yield return null;
+ yield return null;
+ float screen = _layer.resolvedStyle.height > 0f ? _layer.resolvedStyle.height : 1080f;
+ float tall = Mathf.Max(400f, _creditsBox.resolvedStyle.height);
+ float t = 0f;
+ while (t < seconds)
+ {
+ t += Time.deltaTime;
+ float y = Mathf.Lerp(screen, -tall, t / seconds);
+ _creditsBox.style.translate = new Translate(0f, y);
+ yield return null;
+ }
+ _creditsBox.style.display = DisplayStyle.None;
+ }
+
+ IEnumerator End()
+ {
+ _phase = Phase.End;
+ PlayerPrefs.SetInt(SeenKey, 1);
+ PlayerPrefs.Save();
+ _shiftTo = 0f;
+ _theEnd.style.display = DisplayStyle.Flex;
+ _theEnd.style.opacity = 0f;
+ Show(_theEnd, 1.6f);
+ yield return new WaitForSeconds(2.6f);
+ _unless.style.display = DisplayStyle.Flex;
+ _unless.style.opacity = 0f;
+ Show(_unless, 0.8f);
+ yield return new WaitForSeconds(2.2f);
+ Hide(_theEnd, 0.8f);
+ Hide(_unless, 0.8f);
+ Bars(false);
+ _skip.style.display = DisplayStyle.None;
+ yield return new WaitForSeconds(0.6f);
+ OpenCard();
+ _run = null;
+ }
+
+ /// Space / Enter / Esc: whatever is left, straight to THE END and the card.
+ void SkipToEnd()
+ {
+ if (_run != null) StopCoroutine(_run);
+ if (_phase == Phase.Call) DirectorCall.Abort();
+ Sfx.Play("cut_return", 0.5f, 1f, 0f);
+ if (Phone.I && Phone.I.Mode != PhoneMode.Away) Phone.I.Show(PhoneMode.Away);
+ _ring.style.display = DisplayStyle.None;
+ foreach (var e in new VisualElement[] { _titleBox, _line, _stats, _creditsBox, _flash }) { Tween.Kill(e); e.style.display = DisplayStyle.None; }
+ Sfx.Music("music_menu_loop", 1.5f);
+ Bars(true);
+ GrassField.FurReach = 3.5f;
+ // the last picture is Earth, green all over
+ _warp = 0f;
+ EarthSetup();
+ _earth.HealNow();
+ _run = StartCoroutine(End());
+ }
+
+ void Finish()
+ {
+ if (_run != null) StopCoroutine(_run);
+ _run = null;
+ if (_phase == Phase.Call) DirectorCall.Abort();
+ Running = false;
+ _phase = Phase.None;
+ _shot = Shot.None;
+ _shift = _shiftTo = 0f;
+ _warp = 0f;
+ _earth?.Destroy();
+ _earth = null;
+ if (_flash != null) _flash.style.display = DisplayStyle.None;
+ SpaceSky.Set(false, Vector3.zero);
+ GrassField.FurReach = 1f;
+ var cam = CameraFx.Cam;
+ if (cam) { cam.nearClipPlane = 0.05f; cam.farClipPlane = 14000f; }
+ if (cam && cam.transform.parent) cam.transform.SetLocalPositionAndRotation(Vector3.zero, Quaternion.identity);
+ Ctl.Cinematic = false;
+ if (UIRoot.I) UIRoot.I.HideHud(false);
+ Sfx.Duck(1f);
+ if (_cardLayer != null && _cardLayer.pickingMode != PickingMode.Ignore) UIRoot.I?.CloseModal(_cardLayer);
+ _cardLayer = null;
+ if (_layer != null) _layer.style.display = DisplayStyle.None;
+ if (Phone.I && Phone.I.Mode != PhoneMode.Away) Phone.I.Show(PhoneMode.Away);
+ }
+
+ // ───────── the card at the end ─────────
+
+ void OpenCard()
+ {
+ _cardLayer = UIRoot.I.OpenModal(layer =>
+ {
+ var card = UIK.El("card", layer);
+ card.pickingMode = PickingMode.Position;
+ card.style.width = 760;
+ card.style.alignItems = Align.Stretch;
+ UIK.Text(Loc.T("HERBARIA-7 IS MOWN"), "t-h1 t-dark t-center", card);
+ var body = UIK.Text(Loc.T("Earth has grass again. Thank you for mowing with us."), "t-body t-dark t-center", card, false);
+ body.style.whiteSpace = WhiteSpace.Normal;
+ body.style.marginBottom = 10;
+ var note = UIK.Text(Loc.T("The world is still yours: every machine, every belt, every robot."), "t-small t-muted t-center", card, false);
+ note.style.whiteSpace = WhiteSpace.Normal;
+ note.style.marginBottom = 16;
+ UIK.Btn(Loc.T("KEEP MOWING"), () => UIRoot.I.CloseModal(layer), "btn btn-green", card);
+ UIK.Btn(Loc.T("LEAVE A REVIEW"), () => SteamManager.OpenWeb(ReviewUrl), "btn btn-blue", card);
+ UIK.Btn(Loc.T("LEAVE TO MENU"), () => { UIRoot.I.CloseModal(layer); Finish(); NetSession.Instance.Leave(); }, "btn btn-red", card);
+ return card;
+ });
+ }
+
+ // ───────── the screen ─────────
+
+ void Build()
+ {
+ if (_layer == null || _layer.panel == null)
+ {
+ var root = UIRoot.I.Cinema;
+ _layer = UIK.El("layer", root);
+ _layer.pickingMode = PickingMode.Ignore;
+ _flash = new VisualElement { pickingMode = PickingMode.Ignore };
+ _flash.style.position = Position.Absolute;
+ _flash.style.left = _flash.style.right = _flash.style.top = _flash.style.bottom = 0;
+ _flash.style.backgroundColor = new Color(1f, 0.99f, 0.95f);
+ _flash.style.display = DisplayStyle.None;
+ _layer.Add(_flash);
+ _top = Bar(_layer, true);
+ _bottom = Bar(_layer, false);
+ _ring = UIK.Text("", "director-ring t-outline", _layer);
+ _titleBox = UIK.El("ending-titlebox", _layer);
+ _title = UIK.Text("", "ending-title t-outline", _titleBox);
+ _sub = UIK.Text("", "ending-sub t-outline", _titleBox);
+ _line = UIK.Text("", "ending-line t-outline", _layer, false);
+ _stats = UIK.El("ending-stats", _layer);
+ _creditsBox = UIK.El("ending-credits", _layer);
+ _theEnd = UIK.Text("", "ending-theend t-outline", _layer);
+ _unless = UIK.Text("", "ending-unless t-outline", _layer, false);
+ _skip = UIK.Text("", "cinema-skip t-outline", _layer, false);
+ }
+ _layer.style.display = DisplayStyle.Flex;
+ _ring.text = Loc.T("G.R.A.S.S.A. IS CALLING");
+ _theEnd.text = Loc.T("THE END");
+ _unless.text = Loc.T("…unless?");
+ _skip.text = Loc.T("SPACE skip");
+ foreach (var e in new VisualElement[] { _ring, _titleBox, _line, _stats, _creditsBox, _theEnd, _unless }) { Tween.Kill(e); e.style.display = DisplayStyle.None; }
+ _skip.style.display = DisplayStyle.Flex;
+ Bars(false);
+ }
+
+ void FillStats(bool animate)
+ {
+ var ts = TeamState.Instance;
+ _stats.Clear();
+ if (!ts) return;
+ UIK.Text(Loc.T("WHAT YOUR CREW DID"), "ending-stats-head t-outline", _stats);
+ var rows = new List<(string label, double value, System.Func show)>
+ {
+ (Loc.T("Grass shipped to Earth"), ts.Shipped.Value, v => GameDefs.Kilos(v)),
+ (Loc.T("Planet mown"), System.Math.Min(100d, ts.Mown01 * 100d), v => Loc.F("{0}%", Loc.Num(v, "0.##"))),
+ (Loc.T("Sectors mown clean"), ts.Closed.Value, v => Loc.Num(v, "N0")),
+ (Loc.T("Money earned"), ts.Earned.Value, v => UIK.Money(v)),
+ (Loc.T("Days on Herbaria-7"), Mathf.Max(1, ts.Days), v => Loc.Num(v, "N0")),
+ (Loc.T("Machines"), Vehicle.All.Count(v => v), v => Loc.Num(v, "N0")),
+ (Loc.T("Robots at work"), Mowbot.All.Count, v => Loc.Num(v, "N0")),
+ (Loc.T("Stations found"), ts.Opened.Count, v => Loc.F("{0} / {1}", Loc.Num(v, "N0"), Loc.Num(Stations.Count - 1))),
+ (Loc.T("Survey stakes sorted out"), ts.FoundCount(false), v => Loc.F("{0} / {1}", Loc.Num(v, "N0"), Loc.Num(Landmarks.Stakes))),
+ };
+ int i = 0;
+ foreach (var (label, value, show) in rows)
+ {
+ var row = UIK.El("ending-row", _stats);
+ UIK.Text(label, "ending-row-label t-outline", row, false);
+ var val = UIK.Text(show(animate ? 0d : value), "ending-row-value t-outline", row);
+ if (animate)
+ {
+ row.style.opacity = 0f;
+ float delay = 0.25f + i * 0.35f;
+ Tween.Run(row, 0.4f, k => row.style.opacity = k, Ease.OutQuad, delay);
+ Tween.Run(val, 1.3f, k => val.text = show(value * k), Ease.OutQuad, delay);
+ }
+ i++;
+ }
+ var crew = PlayerAgent.All.Where(p => p).Select(p => p.DisplayName).ToList();
+ if (crew.Count > 0)
+ {
+ var c = UIK.Text(Loc.F("The crew: {0}", string.Join(", ", crew)), "ending-crew t-outline", _stats, false);
+ if (animate) { c.style.opacity = 0f; Tween.Run(c, 0.6f, k => c.style.opacity = k, Ease.OutQuad, 0.4f + rows.Count * 0.35f); }
+ }
+ _stats.style.opacity = 1f;
+ _stats.style.display = DisplayStyle.Flex;
+ }
+
+ void FillCredits()
+ {
+ _creditsBox.Clear();
+ UIK.Text("GRASS CUTTERS TOGETHER", "ending-credits-title t-outline", _creditsBox);
+ foreach (var (role, names) in Credits)
+ {
+ UIK.Text(Loc.T(role), "ending-credits-role t-outline", _creditsBox, false);
+ foreach (var n in names) UIK.Text(n, "ending-credits-name t-outline", _creditsBox);
+ }
+ UIK.Text(Loc.T("And you"), "ending-credits-role t-outline", _creditsBox, false);
+ UIK.Text(Loc.T("for every blade."), "ending-credits-name t-outline", _creditsBox);
+ var crew = PlayerAgent.All.Where(p => p).Select(p => p.DisplayName).ToList();
+ foreach (var n in crew) UIK.Text(n, "ending-credits-name t-outline", _creditsBox);
+ UIK.Text(Loc.T("We take grass very seriously."), "ending-credits-motto t-outline", _creditsBox, false);
+ }
+
+ static VisualElement Bar(VisualElement root, bool top)
+ {
+ var b = new VisualElement { pickingMode = PickingMode.Ignore };
+ b.AddToClassList("cinema-bars");
+ if (top) b.style.top = 0; else b.style.bottom = 0;
+ b.style.display = DisplayStyle.None;
+ root.Add(b);
+ return b;
+ }
+
+ void Bars(bool on)
+ {
+ if (_top == null) return;
+ _top.style.display = _bottom.style.display = on ? DisplayStyle.Flex : DisplayStyle.None;
+ }
+
+ static void Show(VisualElement e, float seconds)
+ {
+ e.style.display = DisplayStyle.Flex;
+ Tween.Kill(e);
+ e.style.opacity = 0f;
+ Tween.Run(e, seconds, k => e.style.opacity = k, Ease.InOutQuad);
+ }
+
+ static void Hide(VisualElement e, float seconds)
+ {
+ float from = e.resolvedStyle.opacity;
+ Tween.Kill(e);
+ Tween.Run(e, seconds, k => e.style.opacity = Mathf.Lerp(from, 0f, k), Ease.InOutQuad, 0f, () => e.style.display = DisplayStyle.None);
+ }
+
+ // ───────── the camera ─────────
+
+ void Orbit(Vector3 from, Vector3 axisHint)
+ {
+ OrbitSetup(from, axisHint);
+ _shot = Shot.Orbit;
+ SpaceSky.Set(true, Planet.Center + _orbitFrom * _orbitDist);
+ }
+
+ void OrbitSetup(Vector3 from, Vector3 axisHint)
+ {
+ // round the sun's own axis, two thirds of the way to the sunny side of where the cuts ended: the light on the ball
+ // stays the same however far it turns, the day side with the terminator along one edge
+ var sun = Sun.Dir.normalized;
+ var across = Vector3.ProjectOnPlane(from, sun);
+ if (across.sqrMagnitude < 0.01f) across = Vector3.ProjectOnPlane(axisHint, sun);
+ across.Normalize();
+ _orbitFrom = (sun * 0.62f + across * 0.78f + Vector3.Cross(sun, across) * 0.1f).normalized;
+ _orbitAxis = sun;
+ _orbitAngle = 0f;
+ _orbitSpeed = 2.2f;
+ _orbitDist = Planet.Radius * 2.6f;
+ _near = 4f;
+ _far = 60000f;
+ }
+
+ /// The orbit's eye and up at an angle round it.
+ void OrbitPose(float angle, out Vector3 eye, out Vector3 up)
+ {
+ var dir = Quaternion.AngleAxis(angle, _orbitAxis) * _orbitFrom;
+ eye = Planet.Center + dir * _orbitDist;
+ up = Vector3.ProjectOnPlane(Vector3.Cross(_orbitAxis, dir), dir).normalized;
+ if (up.sqrMagnitude < 0.01f) up = Vector3.ProjectOnPlane(Vector3.up, dir).normalized;
+ }
+
+ void LateUpdate()
+ {
+ var cam = CameraFx.Cam;
+ if (!cam || !Running || _shot == Shot.None) return;
+ if (_shot == Shot.Path)
+ {
+ _pathT += Time.deltaTime;
+ float k = Mathf.Clamp01(_pathT / _pathFor);
+ // eased in and out, but never standing still at either end of a flight
+ k = Mathf.Lerp(k, k * k * (3f - 2f * k), 0.6f);
+ float u = k * (_pathEyes.Length - 1);
+ var e = Spline(_pathEyes, u);
+ // never under the ground between the points
+ float alt = Planet.Altitude(e);
+ if (alt < 0.9f) e += Planet.Up(e) * (0.9f - alt);
+ var l = Spline(_pathLooks, u);
+ cam.transform.SetPositionAndRotation(e, Quaternion.LookRotation(l - e, Planet.Up(e)));
+ }
+ else if (_shot == Shot.Rise)
+ {
+ _pathT += Time.deltaTime;
+ float k = Mathf.Clamp01(_pathT / _pathFor);
+ OrbitPose(0f, out var oEye, out var oUp);
+ // the height grows by the same factor every second: the ground falls away the same at 10 m as at 10 km
+ float altTo = _orbitDist - Planet.Radius;
+ float alt = Mathf.Exp(Mathf.Lerp(Mathf.Log(_riseAlt0), Mathf.Log(altTo), Mathf.Pow(k, 1.2f)));
+ // straight up over the base first, then across to where the orbit begins
+ float across = Mathf.SmoothStep(0f, 1f, Mathf.InverseLerp(0.4f, 1f, k));
+ var dir = Vector3.Slerp(Planet.Up(_riseFrom), (oEye - Planet.Center).normalized, across);
+ var e = Planet.Center + dir * (Planet.Radius + alt);
+ float lookK = Mathf.SmoothStep(0f, 1f, Mathf.InverseLerp(0.45f, 0.95f, k));
+ var l = Vector3.Lerp(_riseLook, Planet.Center, lookK);
+ var upE = Planet.Up(e);
+ var top = Vector3.ProjectOnPlane(_riseTop, upE);
+ // the head tips down over the base as it climbs: the top of the frame leans from the sky to the way ahead
+ var upv = top.sqrMagnitude > 1e-4f ? Vector3.Slerp(upE, top.normalized, Mathf.InverseLerp(15f, 300f, alt) * 0.95f) : upE;
+ upv = Vector3.Slerp(upv, oUp, Mathf.SmoothStep(0f, 1f, Mathf.InverseLerp(0.6f, 1f, k)));
+ var fwd = l - e;
+ if (Vector3.Cross(fwd.normalized, upv).sqrMagnitude < 1e-4f) upv = top.sqrMagnitude > 1e-4f ? top.normalized : oUp;
+ cam.transform.SetPositionAndRotation(e, Quaternion.LookRotation(fwd, upv));
+ _near = Mathf.Clamp(alt * 0.004f, 0.05f, 4f);
+ _far = alt > 500f ? 60000f : 14000f;
+ // the sky goes black while the lens still looks down at the ground, before the edge of the ball is in view
+ if (alt > Planet.Radius * 0.15f && !SpaceSky.On) SpaceSky.Set(true, e);
+ }
+ else if (_shot == Shot.Earth)
+ {
+ if (_earth == null) return;
+ float dt = Time.deltaTime;
+ _earth.Tick(dt);
+ // slowly round towards the sun and in a little: more of the ball lit as it turns green
+ _eTheta = Mathf.MoveTowards(_eTheta, 22f, dt * 0.6f);
+ _eDist = Mathf.Lerp(_eDist, _eDistTo, 1f - Mathf.Exp(-dt * 0.12f));
+ _shift = Mathf.Lerp(_shift, _shiftTo, 1f - Mathf.Exp(-dt * 0.9f));
+ var pose = EarthPose();
+ cam.transform.SetPositionAndRotation(pose.position, pose.rotation);
+ }
+ else
+ {
+ _orbitAngle += _orbitSpeed * Time.deltaTime;
+ _shift = Mathf.Lerp(_shift, _shiftTo, 1f - Mathf.Exp(-Time.deltaTime * 0.9f));
+ OrbitPose(_orbitAngle, out var e, out var up0);
+ var dir = (e - Planet.Center).normalized;
+ if (_warp > 0f) e += dir * _orbitDist * 2.5f * _warp;
+ var right = Vector3.Cross(up0, -dir).normalized;
+ // the ball slides to the right of the frame while the words are on the left
+ var look = Planet.Center - right * Planet.Radius * 1.25f * _shift;
+ cam.transform.SetPositionAndRotation(e, Quaternion.LookRotation(look - e, up0));
+ }
+ cam.nearClipPlane = _near;
+ cam.farClipPlane = _far;
+ }
+ }
+}
diff --git a/Assets/Scripts/UI/EndingCinematic.cs.meta b/Assets/Scripts/UI/EndingCinematic.cs.meta
new file mode 100644
index 0000000..1098ae6
--- /dev/null
+++ b/Assets/Scripts/UI/EndingCinematic.cs.meta
@@ -0,0 +1,2 @@
+fileFormatVersion: 2
+guid: a6cb6c4b85fee22449391cd24bfe0fdb
\ No newline at end of file
diff --git a/Assets/Scripts/UI/EndingEarth.cs b/Assets/Scripts/UI/EndingEarth.cs
new file mode 100644
index 0000000..08911bf
--- /dev/null
+++ b/Assets/Scripts/UI/EndingEarth.cs
@@ -0,0 +1,419 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+namespace GrassCutter
+{
+ ///
+ /// The ending's last stop: Earth, out in a patch of space of its own, scorched and dried out. A rocket from Herbaria-7
+ /// comes past the lens and down onto it, and from where it lands the green spreads over the whole ball, seed pods thrown
+ /// off it starting patches of their own, the air going from dust to blue and the clouds coming back.
+ ///
+ public sealed class EndingEarth
+ {
+ public const float R = 2000f;
+ // a seed spread this far (radians, before the shader's wobble) has covered the ball
+ const float Full = 4.8f;
+ const int MaxSeeds = 12;
+ const float Spin = 1.1f;
+
+ public readonly Vector3 Center;
+ /// Towards the sun; the frame the camera keeps to: Side across the sun, Up square to both.
+ public readonly Vector3 Sun, Side, Up;
+ /// The main patch has covered the ball.
+ public bool Healed => _seeds.Count > 0 && _seeds[0].age >= _seeds[0].grow;
+ public bool Landed => _seeds.Count > 0;
+ /// 0 dead … 1 green all over: the air, the clouds.
+ public float Life { get; private set; }
+
+ readonly GameObject _root;
+ readonly Transform _ball;
+ readonly Material _mat, _airMat;
+ readonly ParticleSystem _glow, _rings, _sparks;
+ readonly Quaternion _tilt;
+ float _spin;
+
+ class Seed { public Vector3 dir; public float age, grow, full; }
+ class Pod { public Vector3 from, to; public float t, time; }
+ readonly List _seeds = new List();
+ readonly List _pods = new List();
+ readonly Vector4[] _seedVec = new Vector4[MaxSeeds], _seedFx = new Vector4[MaxSeeds];
+
+ static readonly int SeedsId = Shader.PropertyToID("_Seeds"), SeedFxId = Shader.PropertyToID("_SeedFx"), SeedCountId = Shader.PropertyToID("_SeedCount"),
+ LifeId = Shader.PropertyToID("_Life"), AirId = Shader.PropertyToID("_AirColor"), SunId = Shader.PropertyToID("_SunDir"),
+ PowerId = Shader.PropertyToID("_Power"), EdgeId = Shader.PropertyToID("_Edge");
+ static readonly Color DeadAir = new Color(0.85f, 0.52f, 0.28f), LiveAir = new Color(0.3f, 0.58f, 1f);
+ static Mesh s_sphere;
+
+ /// Earth far out from Herbaria-7 (its centre given), on the side of it that the lens keeps behind itself.
+ public EndingEarth(Vector3 herbaria, Vector3 sun)
+ {
+ Sun = sun.normalized;
+ Up = Vector3.ProjectOnPlane(Mathf.Abs(Sun.y) < 0.9f ? Vector3.up : Vector3.right, Sun).normalized;
+ Side = Vector3.Cross(Up, Sun).normalized;
+ // the lens sits between the sun and Side from the ball: Herbaria-7 out along sun + Side is behind it
+ Center = herbaria - (Sun * 0.5f + Side).normalized * 150000f;
+ var center = Center;
+
+ _root = new GameObject("EndingEarth");
+ var ball = new GameObject("Ball", typeof(MeshFilter), typeof(MeshRenderer));
+ _ball = ball.transform;
+ _ball.SetParent(_root.transform, false);
+ _ball.position = center;
+ _ball.localScale = Vector3.one * R;
+ // the poles a little towards the lens, the way a globe stands
+ _tilt = Quaternion.LookRotation(Side, Up) * Quaternion.Euler(16f, 0f, 0f);
+ _ball.rotation = _tilt;
+ ball.GetComponent().sharedMesh = Sphere();
+ _mat = new Material(Resources.Load("Ending/EarthGlobe"));
+ _mat.SetTexture("_DryTex", Resources.Load("Ending/earth_dry"));
+ _mat.SetTexture("_GreenTex", Resources.Load("Ending/earth_green"));
+ var mr = ball.GetComponent();
+ mr.sharedMaterial = _mat;
+ mr.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off;
+ mr.receiveShadows = false;
+
+ var air = new GameObject("Air", typeof(MeshFilter), typeof(MeshRenderer));
+ air.transform.SetParent(_root.transform, false);
+ air.transform.position = center;
+ air.transform.localScale = Vector3.one * R * 1.07f;
+ air.GetComponent().sharedMesh = Sphere();
+ _airMat = new Material(Resources.Load("Ending/EarthAir"));
+ _airMat.SetFloat(EdgeId, Mathf.Sqrt(1f - 1f / (1.07f * 1.07f)));
+ var amr = air.GetComponent();
+ amr.sharedMaterial = _airMat;
+ amr.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off;
+ amr.receiveShadows = false;
+
+ var bank = AssetBank.I;
+ _glow = Particles("Glow", bank.Mat("FX_Soft"), AnimationCurve.EaseInOut(0f, 1f, 1f, 0.6f));
+ _rings = Particles("Rings", bank.Mat("FX_Ring") ?? bank.Mat("FX_Soft"), AnimationCurve.EaseInOut(0f, 0.08f, 1f, 1f));
+ _sparks = Particles("Sparks", bank.Mat("FX_Sparkle") ?? bank.Mat("FX_Soft"), AnimationCurve.EaseInOut(0f, 1f, 1f, 0.2f));
+ Apply();
+ }
+
+ ParticleSystem Particles(string name, Material mat, AnimationCurve size)
+ {
+ var go = new GameObject(name);
+ go.transform.SetParent(_root.transform, false);
+ var ps = go.AddComponent();
+ ps.Stop(true, ParticleSystemStopBehavior.StopEmittingAndClear);
+ var main = ps.main;
+ main.playOnAwake = false; main.loop = false;
+ main.simulationSpace = ParticleSystemSimulationSpace.World;
+ main.maxParticles = 6000;
+ main.startSpeed = 0f;
+ var em = ps.emission; em.enabled = false;
+ var sh = ps.shape; sh.enabled = false;
+ var sol = ps.sizeOverLifetime; sol.enabled = true; sol.size = new ParticleSystem.MinMaxCurve(1f, size);
+ var col = ps.colorOverLifetime; col.enabled = true;
+ var g = new Gradient();
+ g.SetKeys(new[] { new GradientColorKey(Color.white, 0f), new GradientColorKey(Color.white, 1f) },
+ new[] { new GradientAlphaKey(1f, 0f), new GradientAlphaKey(0.8f, 0.4f), new GradientAlphaKey(0f, 1f) });
+ col.color = g;
+ var r = go.GetComponent();
+ r.sharedMaterial = mat;
+ r.maxParticleSize = 4f;
+ r.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off;
+ ps.Play();
+ return ps;
+ }
+
+ static void Emit(ParticleSystem ps, Vector3 pos, Vector3 vel, float size, Color c, float life)
+ {
+ var ep = new ParticleSystem.EmitParams { position = pos, velocity = vel, startSize = size, startColor = c, startLifetime = life, applyShapeToPosition = false };
+ ps.Emit(ep, 1);
+ }
+
+ /// The ball's own direction to a place on the map (latitude, longitude in degrees, as the map is laid out).
+ public static Vector3 Geo(float lat, float lon)
+ {
+ float a = lat * Mathf.Deg2Rad, o = lon * Mathf.Deg2Rad;
+ return new Vector3(Mathf.Cos(a) * Mathf.Cos(o), Mathf.Sin(a), Mathf.Cos(a) * Mathf.Sin(o));
+ }
+
+ /// Spin the ball so the place given (its own direction) faces the world direction given, this many seconds from now.
+ public void Face(Vector3 dirOS, Vector3 worldDir, float inSeconds)
+ {
+ var w = Quaternion.Inverse(_tilt) * worldDir.normalized;
+ float aw = Mathf.Atan2(w.x, w.z) * Mathf.Rad2Deg, ad = Mathf.Atan2(dirOS.x, dirOS.z) * Mathf.Rad2Deg;
+ _spin = aw - ad - Spin * inSeconds;
+ _ball.rotation = _tilt * Quaternion.AngleAxis(_spin, Vector3.up);
+ }
+
+ /// A world point on the ball (a little over it) for a direction in the ball's own space.
+ public Vector3 Surface(Vector3 dirOS, float over = 0f) => Center + _ball.rotation * dirOS.normalized * (R + over);
+ public Vector3 ToBall(Vector3 worldDir) => Quaternion.Inverse(_ball.rotation) * worldDir.normalized;
+
+ public void Tick(float dt)
+ {
+ _spin += dt * Spin;
+ _ball.rotation = _tilt * Quaternion.AngleAxis(_spin, Vector3.up);
+
+ foreach (var s in _seeds) s.age += dt;
+ for (int i = _pods.Count - 1; i >= 0; i--)
+ {
+ var p = _pods[i];
+ p.t += dt;
+ if (p.t < 0f) continue;
+ float k = Mathf.Clamp01(p.t / p.time);
+ var dir = Vector3.Slerp(p.from, p.to, k);
+ var pos = Surface(dir, R * 0.24f * Mathf.Sin(k * Mathf.PI));
+ Emit(_glow, pos, Vector3.zero, 46f, new Color(0.75f, 1f, 0.45f, 0.95f), 0.9f);
+ Emit(_sparks, pos, Random.onUnitSphere * 12f, Random.Range(10f, 18f), new Color(1f, 0.95f, 0.6f), 0.7f);
+ if (k >= 1f)
+ {
+ _pods.RemoveAt(i);
+ Plant(p.to, Random.Range(0.8f, 1.35f), Random.Range(6f, 9f));
+ var at = Surface(p.to, 4f);
+ Emit(_glow, at, Vector3.zero, 320f, new Color(0.8f, 1f, 0.55f, 0.9f), 1f);
+ Emit(_rings, at, Vector3.zero, 900f, new Color(0.7f, 1f, 0.5f, 0.9f), 1.6f);
+ Sfx.Play("plater_shimmer", 0.25f, Random.Range(1.1f, 1.4f), 0f);
+ }
+ }
+
+ // sparkles along every front still moving
+ for (int i = 0; i < _seeds.Count; i++)
+ {
+ var s = _seeds[i];
+ float w = Spread(s);
+ if (w >= s.full * 0.98f || w <= 0f) continue;
+ int n = Mathf.Min(14, Mathf.CeilToInt((i == 0 ? 120f : 30f) * dt * Mathf.Clamp(w, 0.3f, 2f)));
+ var ortho = Vector3.Cross(s.dir, Mathf.Abs(s.dir.y) < 0.9f ? Vector3.up : Vector3.right).normalized;
+ for (int k = 0; k < n; k++)
+ {
+ float a = Mathf.Min(Mathf.PI * 0.999f, w * Random.Range(0.72f, 1.05f));
+ var axis = Quaternion.AngleAxis(Random.Range(0f, 360f), s.dir) * ortho;
+ var d = Quaternion.AngleAxis(a * Mathf.Rad2Deg, axis) * s.dir;
+ var pos = Surface(d, 6f);
+ var nrm = (pos - Center).normalized;
+ Emit(_sparks, pos, nrm * Random.Range(25f, 70f), Random.Range(9f, 22f),
+ Color.Lerp(new Color(0.6f, 1f, 0.35f), new Color(1f, 0.92f, 0.5f), Random.value), Random.Range(0.6f, 1.3f));
+ }
+ }
+ Apply();
+ }
+
+ static float Spread(Seed s)
+ {
+ float k = Mathf.Clamp01(s.age / s.grow);
+ // under way at once, quickest half way, easing into its last stretch
+ return s.full * Mathf.Max(0.5f - 0.5f * Mathf.Cos(Mathf.PI * k), Mathf.Min(k * 0.6f, 0.05f));
+ }
+
+ void Apply()
+ {
+ int n = Mathf.Min(MaxSeeds, _seeds.Count);
+ for (int i = 0; i < MaxSeeds; i++)
+ _seedVec[i] = i < n ? new Vector4(_seeds[i].dir.x, _seeds[i].dir.y, _seeds[i].dir.z, Spread(_seeds[i])) : Vector4.zero;
+ for (int i = 0; i < MaxSeeds; i++)
+ _seedFx[i] = i < n ? new Vector4(1f - Mathf.SmoothStep(0f, 1f, Mathf.InverseLerp(0.7f, 1f, _seeds[i].age / _seeds[i].grow)), 0f, 0f, 0f) : Vector4.zero;
+ _mat.SetVectorArray(SeedsId, _seedVec);
+ _mat.SetVectorArray(SeedFxId, _seedFx);
+ _mat.SetFloat(SeedCountId, n);
+ float main = n > 0 ? Spread(_seeds[0]) / Full : 0f;
+ Life = Mathf.SmoothStep(0f, 1f, Mathf.InverseLerp(0.08f, 0.85f, main));
+ var air = Color.Lerp(DeadAir, LiveAir, Life);
+ _mat.SetFloat(LifeId, Life);
+ _mat.SetColor(AirId, air);
+ _mat.SetVector(SunId, Sun);
+ _airMat.SetColor(AirId, air);
+ _airMat.SetVector(SunId, Sun);
+ _airMat.SetFloat(PowerId, Mathf.Lerp(0.55f, 1.25f, Life));
+ }
+
+ void Plant(Vector3 dirOS, float full, float grow)
+ {
+ if (_seeds.Count >= MaxSeeds) return;
+ _seeds.Add(new Seed { dir = dirOS.normalized, full = full, grow = grow });
+ }
+
+ /// The rocket comes down here (a direction in the ball's own space): the flash, and the green under way.
+ public void Land(Vector3 dirOS, Vector3 viewDirWorld)
+ {
+ Plant(dirOS, Full, 17f);
+ var at = Surface(dirOS, 6f);
+ var nrm = (at - Center).normalized;
+ Emit(_glow, at, Vector3.zero, 1100f, new Color(1f, 1f, 0.85f, 1f), 1.3f);
+ Emit(_glow, at, Vector3.zero, 520f, new Color(0.7f, 1f, 0.45f, 1f), 2.2f);
+ Emit(_rings, at, Vector3.zero, 2600f, new Color(0.75f, 1f, 0.55f, 1f), 2.4f);
+ Emit(_rings, at, Vector3.zero, 1500f, new Color(1f, 0.95f, 0.7f, 0.9f), 1.6f);
+ for (int k = 0; k < 90; k++)
+ Emit(_sparks, at, (nrm * 0.8f + Random.insideUnitSphere).normalized * Random.Range(60f, 260f), Random.Range(12f, 30f),
+ Color.Lerp(new Color(0.6f, 1f, 0.35f), new Color(1f, 0.9f, 0.5f), Random.value), Random.Range(1f, 2.2f));
+ // seed pods thrown out all round: half to the side we see, half anywhere
+ var view = ToBall(viewDirWorld);
+ for (int i = 0; i < 9; i++)
+ {
+ Vector3 to;
+ int tries = 0;
+ do
+ {
+ to = Random.onUnitSphere;
+ if (i % 2 == 0 && Vector3.Dot(to, view) < 0.25f) to = Vector3.Slerp(to, view, 0.6f).normalized;
+ } while (Vector3.Angle(to, dirOS) < 35f && ++tries < 20);
+ _pods.Add(new Pod { from = dirOS.normalized, to = to, t = -(0.7f + i * 0.32f), time = Random.Range(1.5f, 2.4f) });
+ }
+ }
+
+ /// Green all over at once (the skip).
+ public void HealNow()
+ {
+ _pods.Clear();
+ if (_seeds.Count == 0) Plant(Vector3.up, Full, 17f);
+ _seeds[0].full = Full;
+ _seeds[0].age = _seeds[0].grow;
+ _rocketDone = true;
+ if (_rocket) _rocket.gameObject.SetActive(false);
+ Apply();
+ }
+
+ // ───────── the rocket ─────────
+
+ Transform _rocket;
+ bool _rocketDone;
+
+ ///
+ /// From behind the lens, past it close on the right, then away and down onto the ball where it lands (a direction in the
+ /// ball's own space). It never gets smaller than a speck with a trail; then it lands.
+ ///
+ /// The lens is asked for each frame (the film's own pose of it: the camera's transform is the player's until late in the frame).
+ public IEnumerator Rocket(System.Func lens, Vector3 landOS, float seconds)
+ {
+ var prefab = AssetBank.I.Model("SM_Rocket");
+ if (prefab)
+ {
+ var go = Object.Instantiate(prefab, _root.transform);
+ foreach (var r in go.GetComponentsInChildren()) { r.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off; r.receiveShadows = false; }
+ foreach (var c in go.GetComponentsInChildren()) Object.Destroy(c);
+ _rocket = go.transform;
+ }
+ float tall = 1f;
+ if (_rocket)
+ {
+ var b = new Bounds(_rocket.position, Vector3.zero);
+ bool any = false;
+ foreach (var r in _rocket.GetComponentsInChildren()) { if (!any) { b = r.bounds; any = true; } else b.Encapsulate(r.bounds); }
+ tall = Mathf.Max(0.1f, b.size.y);
+ }
+ const float Height = 9f;
+ float baseScale = Height / tall;
+
+ // the pass: straight by the lens on the right, measured from the lens as it moves (it is still drifting in on the
+ // ball, about as fast as the rocket goes by); then a boost away along a smooth curve down onto the ball
+ var a0 = new Vector3(6f, -2.2f, -25f);
+ var a1 = new Vector3(9f, -0.6f, 110f);
+ var l0 = lens();
+ var p1 = l0.position + l0.rotation * a0;
+ var passDir = l0.rotation * (a1 - a0).normalized;
+ var up = l0.up;
+ Sfx.Play("rocket_launch", 0.5f, 1.2f, 0f);
+ bool whoosh = false;
+ var prev = p1;
+ float t = 0f;
+ while (t < seconds && !_rocketDone)
+ {
+ t += Time.deltaTime;
+ float k = Mathf.Clamp01(t / seconds);
+ var land = Surface(landOS, 0f);
+ var nrm = (land - Center).normalized;
+ var ln = lens();
+ Vector3 pos;
+ if (k < 0.3f)
+ {
+ pos = ln.position + ln.rotation * Vector3.Lerp(a0, a1, k / 0.3f);
+ // where the pass ends and which way it was going: the curve down starts from there
+ p1 = pos;
+ passDir = ln.rotation * (a1 - a0).normalized;
+ up = ln.up;
+ }
+ else
+ {
+ // off quick, easing in to land
+ float v = (k - 0.3f) / 0.7f;
+ float w = Mathf.Lerp(v, v * v * (3f - 2f * v), 0.85f);
+ var b1 = p1 + passDir * R * 0.9f + up * R * 0.1f;
+ var b2 = land + nrm * R * 0.9f;
+ pos = Bezier(p1, b1, b2, land + nrm * 3f, w);
+ }
+ var dir = pos - prev;
+ if (dir.sqrMagnitude < 1e-6f) dir = passDir;
+ dir.Normalize();
+ float far = Vector3.Distance(ln.position, pos);
+ float s = Mathf.Max(1f, far / 320f);
+ if (_rocket)
+ {
+ _rocket.position = pos;
+ _rocket.rotation = Quaternion.FromToRotation(Vector3.up, dir) * Quaternion.AngleAxis(t * 90f, Vector3.up);
+ _rocket.localScale = Vector3.one * baseScale * s;
+ }
+ // the flame and the trail, filled in between frames so it never breaks into dots
+ float step = Mathf.Max(0.6f, s * 2.2f);
+ int n = Mathf.Clamp(Mathf.CeilToInt(Vector3.Distance(prev, pos) / step), 1, 40);
+ for (int i = 0; i < n; i++)
+ {
+ var at = Vector3.Lerp(prev, pos, (i + 1f) / n);
+ // close by the lens a small flame and no smoke: left in the air there, it would fill the frame
+ float flame = Mathf.Min(s * Random.Range(2.2f, 3.2f), 0.4f + far * 0.035f);
+ Emit(_glow, at - dir * s * 0.4f, -dir * s * 6f, flame, new Color(1f, 0.62f, 0.25f, 0.95f), 0.22f);
+ if (i % 2 == 0 && far > 45f)
+ Emit(_glow, at - dir * s * 1.2f, Random.insideUnitSphere * s * 0.6f, s * Random.Range(2.6f, 3.8f), new Color(0.92f, 0.9f, 0.86f, 0.55f), 2.4f);
+ }
+ if (!whoosh && Vector3.Dot(pos - ln.position, ln.forward) > 0f) { whoosh = true; Sfx.Play("meteor_whoosh", 0.6f, 0.95f, 0f); }
+ prev = pos;
+ yield return null;
+ }
+ if (_rocket) _rocket.gameObject.SetActive(false);
+ if (!_rocketDone)
+ {
+ _rocketDone = true;
+ Sfx.Play("rocket_land", 0.7f, 0.8f, 0f);
+ Sfx.Play("buff_shimmer", 0.5f, 0.9f, 0f);
+ Land(landOS, lens().position - Center);
+ }
+ }
+
+ static Vector3 Bezier(Vector3 a, Vector3 b, Vector3 c, Vector3 d, float t)
+ {
+ float u = 1f - t;
+ return u * u * u * a + 3f * u * u * t * b + 3f * u * t * t * c + t * t * t * d;
+ }
+
+ public void Destroy()
+ {
+ if (_root) Object.Destroy(_root);
+ if (_mat) Object.Destroy(_mat);
+ if (_airMat) Object.Destroy(_airMat);
+ }
+
+ /// A unit sphere fine enough that its edge stays round across the screen.
+ static Mesh Sphere()
+ {
+ if (s_sphere) return s_sphere;
+ const int lon = 160, lat = 80;
+ var v = new Vector3[(lon + 1) * (lat + 1)];
+ var idx = new int[lon * lat * 6];
+ int vi = 0;
+ for (int y = 0; y <= lat; y++)
+ {
+ float th = Mathf.PI * y / lat;
+ for (int x = 0; x <= lon; x++)
+ {
+ float ph = 2f * Mathf.PI * x / lon;
+ v[vi++] = new Vector3(Mathf.Sin(th) * Mathf.Cos(ph), Mathf.Cos(th), Mathf.Sin(th) * Mathf.Sin(ph));
+ }
+ }
+ int ii = 0;
+ for (int y = 0; y < lat; y++)
+ for (int x = 0; x < lon; x++)
+ {
+ int a = y * (lon + 1) + x, b = a + lon + 1;
+ idx[ii++] = a; idx[ii++] = a + 1; idx[ii++] = b;
+ idx[ii++] = a + 1; idx[ii++] = b + 1; idx[ii++] = b;
+ }
+ s_sphere = new Mesh { name = "EndingSphere", indexFormat = UnityEngine.Rendering.IndexFormat.UInt32, vertices = v, normals = v, triangles = idx };
+ s_sphere.RecalculateBounds();
+ return s_sphere;
+ }
+ }
+}
diff --git a/Assets/Scripts/UI/EndingEarth.cs.meta b/Assets/Scripts/UI/EndingEarth.cs.meta
new file mode 100644
index 0000000..1fdd846
--- /dev/null
+++ b/Assets/Scripts/UI/EndingEarth.cs.meta
@@ -0,0 +1,2 @@
+fileFormatVersion: 2
+guid: 6e85e4a557582c84b83f91a694a144fb
\ No newline at end of file
diff --git a/Assets/Scripts/UI/IntroCinematic.cs b/Assets/Scripts/UI/IntroCinematic.cs
index 18adc30..012c21d 100644
--- a/Assets/Scripts/UI/IntroCinematic.cs
+++ b/Assets/Scripts/UI/IntroCinematic.cs
@@ -20,7 +20,7 @@ namespace GrassCutter
/// The trailer films it without the "Space: skip" in the corner.
public static bool NoSkipHint;
/// A game starting now could open on the film (not under a dev bot unless it asked).
- public static bool MightRun => Force || !CommandLine.Has("-autodemo");
+ public static bool MightRun => Force || (!CommandLine.Has("-autodemo") && !EndingCinematic.Preview);
/// Whether the film plays has been decided for this game and it isn't playing: until then nobody talks.
public static bool Settled { get; private set; }
@@ -56,7 +56,7 @@ namespace GrassCutter
{
_tried = true;
bool fresh = ts.Shipped.Value <= 0d && ts.Mown.Value <= 0d;
- bool bot = CommandLine.Has("-autodemo");
+ bool bot = CommandLine.Has("-autodemo") || EndingCinematic.Preview;
if ((fresh && !bot) || Force) _run = StartCoroutine(Run());
else { UIRoot.I?.ReleaseFade(0.6f); Settled = true; }
}
@@ -240,62 +240,7 @@ namespace GrassCutter
// ───────── out in space: black sky and stars instead of the day's blue ─────────
- ParticleSystem _stars;
- CameraClearFlags _clear;
- Color _clearColour;
- bool _inSpace;
-
- void Space(bool on, Vector3 eye)
- {
- var cam = CameraFx.Cam;
- if (!cam || on == _inSpace) return;
- _inSpace = on;
- if (on)
- {
- _clear = cam.clearFlags;
- _clearColour = cam.backgroundColor;
- cam.clearFlags = CameraClearFlags.SolidColor;
- cam.backgroundColor = new Color(0.008f, 0.012f, 0.03f);
- if (!_stars)
- {
- var go = new GameObject("IntroStars");
- _stars = go.AddComponent();
- _stars.Stop(true, ParticleSystemStopBehavior.StopEmittingAndClear);
- var main = _stars.main;
- main.playOnAwake = false; main.loop = false;
- main.startLifetime = 60f; main.startSpeed = 0f;
- main.simulationSpace = ParticleSystemSimulationSpace.World;
- main.maxParticles = 2000;
- var em = _stars.emission; em.enabled = false;
- var sh = _stars.shape; sh.enabled = false;
- var r = go.GetComponent();
- r.sharedMaterial = AssetBank.I.Mat("FX_Sparkle") ?? AssetBank.I.Mat("FX_Soft");
- r.maxParticleSize = 0.02f;
- r.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off;
- _stars.Play();
- }
- _stars.Clear();
- for (int i = 0; i < 1400; i++)
- {
- var d = Random.onUnitSphere;
- float far = 30000f;
- var ep = new ParticleSystem.EmitParams
- {
- position = eye + d * far,
- startSize = far * Random.Range(0.0012f, 0.0034f),
- startColor = Color.Lerp(new Color(0.75f, 0.85f, 1f), new Color(1f, 0.92f, 0.8f), Random.value) * Random.Range(0.55f, 1f),
- applyShapeToPosition = false,
- };
- _stars.Emit(ep, 1);
- }
- }
- else
- {
- cam.clearFlags = _clear;
- cam.backgroundColor = _clearColour;
- if (_stars) _stars.Clear();
- }
- }
+ static void Space(bool on, Vector3 eye) => SpaceSky.Set(on, eye);
// ───────── the screen ─────────
diff --git a/Assets/Scripts/UI/SpaceSky.cs b/Assets/Scripts/UI/SpaceSky.cs
new file mode 100644
index 0000000..2bec425
--- /dev/null
+++ b/Assets/Scripts/UI/SpaceSky.cs
@@ -0,0 +1,69 @@
+using UnityEngine;
+
+namespace GrassCutter
+{
+ ///
+ /// Out in space for the films: a black sky and a shell of stars round the eye instead of the day's blue. The opening film
+ /// goes up into it once; the ending stays there.
+ ///
+ public static class SpaceSky
+ {
+ static ParticleSystem s_stars;
+ static CameraClearFlags s_clear;
+ static Color s_clearColour;
+ public static bool On { get; private set; }
+
+ public static void Set(bool on, Vector3 eye)
+ {
+ var cam = CameraFx.Cam;
+ if (!cam || on == On) return;
+ On = on;
+ if (on)
+ {
+ s_clear = cam.clearFlags;
+ s_clearColour = cam.backgroundColor;
+ cam.clearFlags = CameraClearFlags.SolidColor;
+ cam.backgroundColor = new Color(0.008f, 0.012f, 0.03f);
+ if (!s_stars)
+ {
+ var go = new GameObject("SpaceStars");
+ Object.DontDestroyOnLoad(go);
+ s_stars = go.AddComponent();
+ s_stars.Stop(true, ParticleSystemStopBehavior.StopEmittingAndClear);
+ var main = s_stars.main;
+ main.playOnAwake = false; main.loop = false;
+ main.startLifetime = 600f; main.startSpeed = 0f;
+ main.simulationSpace = ParticleSystemSimulationSpace.World;
+ main.maxParticles = 2000;
+ var em = s_stars.emission; em.enabled = false;
+ var sh = s_stars.shape; sh.enabled = false;
+ var r = go.GetComponent();
+ r.sharedMaterial = AssetBank.I.Mat("FX_Sparkle") ?? AssetBank.I.Mat("FX_Soft");
+ r.maxParticleSize = 0.02f;
+ r.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off;
+ s_stars.Play();
+ }
+ s_stars.Clear();
+ for (int i = 0; i < 1400; i++)
+ {
+ var d = Random.onUnitSphere;
+ float far = 30000f;
+ var ep = new ParticleSystem.EmitParams
+ {
+ position = eye + d * far,
+ startSize = far * Random.Range(0.0012f, 0.0034f),
+ startColor = Color.Lerp(new Color(0.75f, 0.85f, 1f), new Color(1f, 0.92f, 0.8f), Random.value) * Random.Range(0.55f, 1f),
+ applyShapeToPosition = false,
+ };
+ s_stars.Emit(ep, 1);
+ }
+ }
+ else
+ {
+ cam.clearFlags = s_clear;
+ cam.backgroundColor = s_clearColour;
+ if (s_stars) s_stars.Clear();
+ }
+ }
+ }
+}
diff --git a/Assets/Scripts/UI/SpaceSky.cs.meta b/Assets/Scripts/UI/SpaceSky.cs.meta
new file mode 100644
index 0000000..dff1da7
--- /dev/null
+++ b/Assets/Scripts/UI/SpaceSky.cs.meta
@@ -0,0 +1,2 @@
+fileFormatVersion: 2
+guid: 134b2a0fa4edae24b94694cecc91b9ba
\ No newline at end of file
diff --git a/Assets/Scripts/UI/UIRoot.cs b/Assets/Scripts/UI/UIRoot.cs
index a21ce54..4f63bc9 100644
--- a/Assets/Scripts/UI/UIRoot.cs
+++ b/Assets/Scripts/UI/UIRoot.cs
@@ -70,6 +70,7 @@ namespace GrassCutter
_hud.style.display = DisplayStyle.None;
gameObject.AddComponent();
gameObject.AddComponent();
+ gameObject.AddComponent();
gameObject.AddComponent();
BuildMenu();
BuildConnecting();
@@ -104,7 +105,8 @@ namespace GrassCutter
{
if (_modalStack.Count > 0) CloseTopModal();
else if (Phone.Back()) { }
- else if (_inGame) OpenPause();
+ // the ending takes Esc itself: it jumps to the last card
+ else if (_inGame && !EndingCinematic.Running) OpenPause();
}
if (Ctl.ConsolePressed) ToggleConsole();
if (Ctl.MapPressed && _inGame && _consoleLayer == null)
diff --git a/Assets/Scripts/World/MowMap.cs b/Assets/Scripts/World/MowMap.cs
index 00d0103..52eab6d 100644
--- a/Assets/Scripts/World/MowMap.cs
+++ b/Assets/Scripts/World/MowMap.cs
@@ -700,11 +700,31 @@ namespace GrassCutter
/// How much of a sector is mown, 0..1.
public static float Cleared(int id) => s_masks.TryGetValue(id, out var m) ? Cleared(m) : 0f;
- /// Square metres mown on the whole planet, as this peer knows it.
- public static float MownArea()
+ ///
+ /// Sectors that still have grass standing, as of the last . The base, the rocks and a few sectors
+ /// with no grass at all keep the mown area a little under the planet's (99.8% with everything cut), so "all of it"
+ /// is this reaching 0, not the area reaching the planet's.
+ ///
+ public static int Left { get; private set; } = int.MaxValue;
+
+ /// Square metres mown on the whole planet, as this peer knows it (and on the way).
+ public static double MownArea()
{
- float sum = 0f;
- foreach (var m in s_masks.Values) sum += m.mown;
+ double sum = 0d;
+ int missing = HexGrid.Cells - s_masks.Count, left = missing;
+ foreach (var m in s_masks.Values)
+ {
+ sum += m.mown;
+ if (!m.done && m.total > 0f) left++;
+ }
+ // the last few sectors nobody has set foot in: open them to see whether there is any grass there at all
+ if (missing > 0 && missing <= 64)
+ {
+ left -= missing;
+ for (int id = 0; id < HexGrid.Cells; id++)
+ if (!s_masks.ContainsKey(id) && Total(id) > 0f) left++;
+ }
+ Left = left;
return sum;
}
diff --git a/Assets/Scripts/World/Soundscape.cs b/Assets/Scripts/World/Soundscape.cs
index 4f8b7f9..fd60f03 100644
--- a/Assets/Scripts/World/Soundscape.cs
+++ b/Assets/Scripts/World/Soundscape.cs
@@ -45,6 +45,8 @@ namespace GrassCutter
if (_night) _dark = (_dark + 1) % Nights.Length;
else _day = (_day + 1) % Days.Length;
}
+ // the ending plays its own tune under the planet
+ if (EndingCinematic.Running) return;
Sfx.Music(WeatherFx.Storm > 0.5f ? "music_storm_loop" : _night ? Nights[_dark] : Days[_day], 4f);
}
}
diff --git a/Assets/Shaders/Ground.shader b/Assets/Shaders/Ground.shader
index 345a07e..63a80bc 100644
--- a/Assets/Shaders/Ground.shader
+++ b/Assets/Shaders/Ground.shader
@@ -43,6 +43,8 @@ Shader "GrassCutter/Ground"
CBUFFER_END
float _GcSkyOn, _GcTime;
+ // 1 once the whole planet is mown (EndingCinematic): the far meadow is stubble and soil, as the cut sectors are drawn
+ float _GcBald;
float4 _GcCam;
float4x4 _GcSkyRot;
float4 _GcIcoN[20], _GcIcoR0[20], _GcIcoR1[20], _GcIcoR2[20];
@@ -98,6 +100,8 @@ Shader "GrassCutter/Ground"
// meadow floor: dark and dense near (the blades stand on it), lighter canopy colour far away
float dist = length(p - _GcCam.xyz);
float3 col = lerp(_Meadow.rgb, _MeadowFar.rgb, smoothstep(40, 150, dist)) * lerp(0.8, 1.15, n1) * lerp(0.9, 1.08, n3);
+ float3 stubble = lerp(float3(0.46, 0.37, 0.12), float3(0.34, 0.25, 0.1), smoothstep(0.35, 0.65, n1) * 0.7) * lerp(0.86, 1.1, n3);
+ col = lerp(col, stubble, _GcBald);
// steep hillsides are rock
float3 nrm = normalize(i.normalWS);
float3 up = normalize(i.dir);
diff --git a/Assets/UI/GrassCutter.uss b/Assets/UI/GrassCutter.uss
index 7c78301..2b45274 100644
--- a/Assets/UI/GrassCutter.uss
+++ b/Assets/UI/GrassCutter.uss
@@ -1046,3 +1046,49 @@
.ladder-price-later { color: #8F8672; -unity-font-style: normal; }
.detail-req { margin-top: 8px; }
.detail-maxed { font-size: 40px; }
+
+/* ───────── the ending: words over the mown planet, the crew's results, the credits ───────── */
+.ending-titlebox {
+ position: absolute; left: 0; right: 0; top: 30%;
+ align-items: center;
+}
+.ending-title { font-size: 120px; color: #FFFFFF; letter-spacing: 8px; -unity-text-align: middle-center; }
+.ending-sub { font-size: 48px; color: #E6B83C; letter-spacing: 6px; -unity-text-align: middle-center; margin-top: 6px; }
+.ending-line {
+ position: absolute; left: 10%; right: 10%; bottom: 22%;
+ -unity-text-align: middle-center; white-space: normal;
+ font-size: 40px; color: #FFFFFF;
+}
+.ending-stats {
+ position: absolute; left: 6%; top: 16%; width: 38%;
+ padding: 26px 34px 26px 34px;
+ border-radius: 18px;
+ background-color: rgba(8, 12, 22, 0.55);
+}
+.ending-stats-head { font-size: 34px; color: #E6B83C; letter-spacing: 3px; margin-bottom: 14px; }
+.ending-row {
+ flex-direction: row; justify-content: space-between; align-items: center;
+ padding: 6px 0 6px 0;
+ border-bottom-width: 1px; border-color: rgba(255, 255, 255, 0.14);
+}
+.ending-row-label { font-size: 24px; color: #D9E4C2; flex-shrink: 1; white-space: normal; }
+.ending-row-value { font-size: 30px; color: #FFFFFF; -unity-text-align: middle-right; margin-left: 18px; flex-shrink: 0; }
+.ending-crew { font-size: 21px; color: #B8C79A; margin-top: 14px; white-space: normal; }
+.ending-credits {
+ position: absolute; left: 6%; top: 0; width: 38%;
+ align-items: center;
+}
+.ending-credits-title { font-size: 56px; color: #FFFFFF; margin-bottom: 60px; -unity-text-align: middle-center; }
+.ending-credits-role { font-size: 22px; color: #E6B83C; letter-spacing: 3px; margin-top: 46px; margin-bottom: 8px; -unity-text-align: middle-center; }
+.ending-credits-name { font-size: 32px; color: #FFFFFF; margin-bottom: 4px; -unity-text-align: middle-center; white-space: normal; }
+.ending-credits-motto { font-size: 26px; color: #B8C79A; margin-top: 90px; -unity-text-align: middle-center; }
+.ending-theend {
+ position: absolute; left: 0; right: 0; top: 40%;
+ -unity-text-align: middle-center;
+ font-size: 96px; color: #FFFFFF; letter-spacing: 10px;
+}
+.ending-unless {
+ position: absolute; left: 0; right: 0; top: 54%;
+ -unity-text-align: middle-center;
+ font-size: 30px; color: #E6B83C;
+}