Skip to content

A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.

fix(map): a lit sea plane past the map's edge removes the sea seam (fix round 1, review M7)

eyalgolan9f35e7755e56
diff --git a/unity/Assets/Editor/MapCapture.cs b/unity/Assets/Editor/MapCapture.cs
index 41bc64b0c..d6f321d9f 100644
--- a/unity/Assets/Editor/MapCapture.cs
+++ b/unity/Assets/Editor/MapCapture.cs
@@ -29,7 +29,7 @@ public static class MapCapture
var scene = EditorSceneManager.NewScene(NewSceneSetup.DefaultGameObjects, NewSceneMode.Single);
var controller = Camera.main.gameObject.AddComponent<CameraController>(); // adds the CameraRig it requires
var map = new GameObject("MapScene").AddComponent<MapScene>();
- map.Configure(Load(MapMaterials.TerrainPath), Load(MapMaterials.OverlayPath), Load(MapMaterials.MarkerPath), Load(MapMaterials.SelectionPath));
+ map.Configure(Load(MapMaterials.TerrainPath), Load(MapMaterials.OverlayPath), Load(MapMaterials.MarkerPath), Load(MapMaterials.SelectionPath), Load(MapMaterials.SeaPath));
var boot = new GameObject("Boot").AddComponent<GameBoot>();
boot.Configure(map);
var placements = new GameObject("Placements").AddComponent<PlacementLayer>();
diff --git a/unity/Assets/Editor/MapMaterials.cs b/unity/Assets/Editor/MapMaterials.cs
index 91967e890..fb7dd34c7 100644
--- a/unity/Assets/Editor/MapMaterials.cs
+++ b/unity/Assets/Editor/MapMaterials.cs
@@ -13,6 +13,7 @@ namespace Statecraft.Game.EditorTools
public const string OverlayPath = Folder + "/HexOverlay.mat";
public const string MarkerPath = Folder + "/SettlementMarker.mat";
public const string SelectionPath = Folder + "/HexSelection.mat";
+ public const string SeaPath = Folder + "/Sea.mat";
public static void Create()
{
@@ -29,6 +30,14 @@ namespace Statecraft.Game.EditorTools
EditorUtility.SetDirty(marker);
// The selected hex's outline: its own shader (Assets/Shaders/HexSelection.shader) with a depth offset (fix round 1, M2).
Make(SelectionPath, "Statecraft/HexSelection", Statecraft.Game.Map.MapScene.SelectionColour);
+ // The sea past the map's edge: URP Lit in the sea biome colour, matte like the terrain's layers, so it is lit as the
+ // terrain's sea is and no seam shows at the edge (fix round 1).
+ var sea = Make(SeaPath, "Universal Render Pipeline/Lit", Statecraft.Game.Map.MapBuilder.BiomeColours["sea"]);
+ // Terrain/Lit keeps its specular and environment reflections at smoothness 0, so the plane keeps them too.
+ sea.SetFloat("_Smoothness", 0f); sea.SetFloat("_Metallic", 0f);
+ sea.SetFloat("_SpecularHighlights", 1f); sea.SetFloat("_EnvironmentReflections", 1f);
+ sea.DisableKeyword("_SPECULARHIGHLIGHTS_OFF"); sea.DisableKeyword("_ENVIRONMENTREFLECTIONS_OFF");
+ EditorUtility.SetDirty(sea);
AssetDatabase.SaveAssets();
}
diff --git a/unity/Assets/Map.unity b/unity/Assets/Map.unity
index a2895b2ba..1ea8c3e08 100644
--- a/unity/Assets/Map.unity
+++ b/unity/Assets/Map.unity
@@ -383,6 +383,7 @@ MonoBehaviour:
overlayMaterial: {fileID: 2100000, guid: 29dd83b7b3b1f4a4aa5a710be0078164, type: 2}
markerMaterial: {fileID: 2100000, guid: 7c65bbd4355344f1990495c458323a4e, type: 2}
selectionMaterial: {fileID: 2100000, guid: 6116b1f8c72b244e0a9556c2cdb6b1c5, type: 2}
+ seaMaterial: {fileID: 2100000, guid: 5bb451931546c49d6b2fe35726d07cfd, type: 2}
--- !u!4 &1195372453
Transform:
m_ObjectHideFlags: 0
diff --git a/unity/Assets/Materials/Sea.mat b/unity/Assets/Materials/Sea.mat
new file mode 100644
index 000000000..eb7326bed
--- /dev/null
+++ b/unity/Assets/Materials/Sea.mat
@@ -0,0 +1,137 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!21 &2100000
+Material:
+ serializedVersion: 8
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_Name: Sea
+ m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3}
+ m_Parent: {fileID: 0}
+ m_ModifiedSerializedProperties: 0
+ m_ValidKeywords: []
+ m_InvalidKeywords: []
+ m_LightmapFlags: 4
+ m_EnableInstancingVariants: 1
+ m_DoubleSidedGI: 0
+ m_CustomRenderQueue: -1
+ stringTagMap:
+ RenderType: Opaque
+ disabledShaderPasses:
+ - MOTIONVECTORS
+ m_LockedProperties:
+ m_SavedProperties:
+ serializedVersion: 3
+ m_TexEnvs:
+ - _BaseMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _BumpMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _DetailAlbedoMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _DetailMask:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _DetailNormalMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _EmissionMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _MainTex:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _MetallicGlossMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _OcclusionMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _ParallaxMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _SpecGlossMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - unity_Lightmaps:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - unity_LightmapsInd:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - unity_ShadowMasks:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ m_Ints: []
+ m_Floats:
+ - _AddPrecomputedVelocity: 0
+ - _AlphaClip: 0
+ - _AlphaToMask: 0
+ - _Blend: 0
+ - _BlendModePreserveSpecular: 1
+ - _BumpScale: 1
+ - _ClearCoatMask: 0
+ - _ClearCoatSmoothness: 0
+ - _Cull: 2
+ - _Cutoff: 0.5
+ - _DetailAlbedoMapScale: 1
+ - _DetailNormalMapScale: 1
+ - _DstBlend: 0
+ - _DstBlendAlpha: 0
+ - _EnvironmentReflections: 1
+ - _GlossMapScale: 0
+ - _Glossiness: 0
+ - _GlossyReflections: 0
+ - _Metallic: 0
+ - _OcclusionStrength: 1
+ - _Parallax: 0.005
+ - _QueueOffset: 0
+ - _ReceiveShadows: 1
+ - _Smoothness: 0
+ - _SmoothnessTextureChannel: 0
+ - _SpecularHighlights: 1
+ - _SrcBlend: 1
+ - _SrcBlendAlpha: 1
+ - _Surface: 0
+ - _WorkflowMode: 1
+ - _XRMotionVectorsPass: 1
+ - _ZWrite: 1
+ m_Colors:
+ - _BaseColor: {r: 0.16, g: 0.42, b: 0.55, a: 1}
+ - _Color: {r: 0.15999997, g: 0.41999996, b: 0.54999995, a: 1}
+ - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
+ - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
+ m_BuildTextureStacks: []
+ m_AllowLocking: 1
+--- !u!114 &3701379141917814585
+MonoBehaviour:
+ m_ObjectHideFlags: 11
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 0}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
+ m_Name:
+ m_EditorClassIdentifier: Unity.RenderPipelines.Universal.Editor::UnityEditor.Rendering.Universal.AssetVersion
+ version: 10
diff --git a/unity/Assets/Materials/Sea.mat.meta b/unity/Assets/Materials/Sea.mat.meta
new file mode 100644
index 000000000..d2b59aaf0
--- /dev/null
+++ b/unity/Assets/Materials/Sea.mat.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 5bb451931546c49d6b2fe35726d07cfd
+NativeFormatImporter:
+ externalObjects: {}
+ mainObjectFileID: 2100000
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/unity/Assets/Scripts/Map/MapScene.cs b/unity/Assets/Scripts/Map/MapScene.cs
index c17baef11..7913d410b 100644
--- a/unity/Assets/Scripts/Map/MapScene.cs
+++ b/unity/Assets/Scripts/Map/MapScene.cs
@@ -11,7 +11,7 @@ namespace Statecraft.Game.Map
/// component calls Build(inputs) once the inputs are loaded (fetched on WebGL); editor tools call Build().</summary>
public sealed class MapScene : MonoBehaviour
{
- [SerializeField] Material terrainMaterial, overlayMaterial, markerMaterial, selectionMaterial;
+ [SerializeField] Material terrainMaterial, overlayMaterial, markerMaterial, selectionMaterial, seaMaterial;
public GeoFrame Frame { get; private set; }
/// <summary>hexes.json as the last Build read it (bounds, hex size, biomes).</summary>
@@ -21,6 +21,12 @@ namespace Statecraft.Game.Map
/// <summary>The selected hex's outline: a child of the terrain (so a rebuild destroys it).</summary>
public const string SelectionName = "HexSelection";
+ /// <summary>The sea past the map's edge: a child of the terrain (so a rebuild destroys it).</summary>
+ public const string SeaPlaneName = "SeaPlane";
+ /// <summary>How far the sea plane reaches past the terrain on every side; the camera never sees farther (MaxDistance).</summary>
+ public const float SeaMarginM = 500_000f;
+ /// <summary>Depth of the sea plane under sea level, so the terrain's own sea draws over it inside the map.</summary>
+ public const float SeaPlaneDropM = 30f;
/// <summary>Highlight colour of the selected hex (the UI's gold, brighter, to read against every biome); MapMaterials
/// bakes it into the editor-made HexSelection.mat.</summary>
public static readonly Color SelectionColour = new Color(1f, 0.84f, 0.38f);
@@ -80,8 +86,8 @@ namespace Statecraft.Game.Map
mr.enabled = true;
}
- public void Configure(Material terrain, Material overlay, Material marker, Material selection)
- { terrainMaterial = terrain; overlayMaterial = overlay; markerMaterial = marker; selectionMaterial = selection; }
+ public void Configure(Material terrain, Material overlay, Material marker, Material selection, Material sea)
+ { terrainMaterial = terrain; overlayMaterial = overlay; markerMaterial = marker; selectionMaterial = selection; seaMaterial = sea; }
/// <summary>Builds from the repository files with System.IO (editor and desktop only).</summary>
public void Build() => Build(GameInputs.MapFromDisk(Paths.Content, Paths.StreamingMap));
@@ -93,6 +99,7 @@ namespace Statecraft.Game.Map
if (overlayMaterial == null) throw new InvalidOperationException("MapScene: overlayMaterial is not assigned");
if (markerMaterial == null) throw new InvalidOperationException("MapScene: markerMaterial is not assigned");
if (selectionMaterial == null) throw new InvalidOperationException("MapScene: selectionMaterial is not assigned");
+ if (seaMaterial == null) throw new InvalidOperationException("MapScene: seaMaterial is not assigned");
var cam = Camera.main;
if (cam == null) throw new InvalidOperationException("MapScene needs a camera tagged MainCamera");
@@ -103,6 +110,7 @@ namespace Statecraft.Game.Map
terrainGo.transform.SetParent(transform, true);
Terrain = terrainGo.GetComponent<Terrain>();
var size = Terrain.terrainData.size;
+ AddSeaPlane(terrainGo.transform, size, (0f - meta.elev_min_m) * MapBuilder.VerticalExaggeration);
Frame = new GeoFrame(meta.lon0, meta.lon1, meta.lat0, meta.lat1, size.x, size.z);
var list = SettlementPlacer.Parse(inputs.SettlementsYaml, (meta.lon0, meta.lon1, meta.lat0, meta.lat1), SettlementsPath);
SettlementPlacer.Place(list, Frame, Terrain, markerMaterial).transform.SetParent(transform, true);
@@ -116,6 +124,22 @@ namespace Statecraft.Game.Map
assets.Own(rig.Volume.profile);
}
+ /// <summary>A lit plane in the sea colour, just under sea level (0 m: heightmap sea), reaching SeaMarginM past the
+ /// terrain: past the map's edge the sea is lit as the terrain's sea is, so no seam shows (fix round 1). Drawn with the
+ /// editor-made Sea.mat on Unity's built-in quad; no collider, so clicks still pick only the terrain.</summary>
+ void AddSeaPlane(Transform terrain, Vector3 size, float seaLevelY)
+ {
+ var plane = new GameObject(SeaPlaneName);
+ plane.transform.SetParent(terrain, false);
+ plane.AddComponent<MeshFilter>().sharedMesh = Resources.GetBuiltinResource<Mesh>("Quad.fbx");
+ var renderer = plane.AddComponent<MeshRenderer>();
+ renderer.sharedMaterial = seaMaterial;
+ renderer.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off;
+ plane.transform.localPosition = new Vector3(size.x / 2, seaLevelY - SeaPlaneDropM, size.z / 2);
+ plane.transform.localRotation = Quaternion.Euler(90f, 0f, 0f); // the quad faces -Z; this turns it to face up
+ plane.transform.localScale = new Vector3(size.x + 2 * SeaMarginM, size.z + 2 * SeaMarginM, 1f);
+ }
+
static string MetaPath => "heightmap.json";
static string HexesPath => "hexes.json";
static string SettlementsPath => SettlementPlacer.DefaultFileName;
diff --git a/unity/Assets/Tests/EditMode/MapActionUiTests.cs b/unity/Assets/Tests/EditMode/MapActionUiTests.cs
index 7448b2a41..ebb05a27b 100644
--- a/unity/Assets/Tests/EditMode/MapActionUiTests.cs
+++ b/unity/Assets/Tests/EditMode/MapActionUiTests.cs
@@ -113,7 +113,8 @@ public class MapActionUiTests
map.Configure(AssetDatabase.LoadAssetAtPath<Material>("Assets/Materials/Terrain.mat"),
AssetDatabase.LoadAssetAtPath<Material>("Assets/Materials/HexOverlay.mat"),
AssetDatabase.LoadAssetAtPath<Material>("Assets/Materials/SettlementMarker.mat"),
- AssetDatabase.LoadAssetAtPath<Material>("Assets/Materials/HexSelection.mat"));
+ AssetDatabase.LoadAssetAtPath<Material>("Assets/Materials/HexSelection.mat"),
+ AssetDatabase.LoadAssetAtPath<Material>("Assets/Materials/Sea.mat"));
map.Build();
var layer = new GameObject("Placements").AddComponent<PlacementLayer>();
var tlv = C.SettlementHexes.Single(s => s.Id == "tel_aviv");
@@ -240,7 +241,8 @@ public class MapActionUiTests
map.Configure(AssetDatabase.LoadAssetAtPath<Material>("Assets/Materials/Terrain.mat"),
AssetDatabase.LoadAssetAtPath<Material>("Assets/Materials/HexOverlay.mat"),
AssetDatabase.LoadAssetAtPath<Material>("Assets/Materials/SettlementMarker.mat"),
- AssetDatabase.LoadAssetAtPath<Material>("Assets/Materials/HexSelection.mat"));
+ AssetDatabase.LoadAssetAtPath<Material>("Assets/Materials/HexSelection.mat"),
+ AssetDatabase.LoadAssetAtPath<Material>("Assets/Materials/Sea.mat"));
map.Build();
Physics.SyncTransforms();
return map;
diff --git a/unity/Assets/Tests/EditMode/SettlementTests.cs b/unity/Assets/Tests/EditMode/SettlementTests.cs
index 15ed61f3b..1bd9f8776 100644
--- a/unity/Assets/Tests/EditMode/SettlementTests.cs
+++ b/unity/Assets/Tests/EditMode/SettlementTests.cs
@@ -8,6 +8,7 @@ using UnityEditor.SceneManagement;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
+using UnityEngine.TestTools;
public class SettlementTests
{
@@ -129,7 +130,7 @@ public class MapSceneTests
static string RealYamlPath => Path.Combine(Paths.Content, "map", "settlements_1948.yaml");
const string TerrainMatPath = "Assets/Materials/Terrain.mat", OverlayMatPath = "Assets/Materials/HexOverlay.mat",
- MarkerMatPath = "Assets/Materials/SettlementMarker.mat", SelectionMatPath = "Assets/Materials/HexSelection.mat";
+ MarkerMatPath = "Assets/Materials/SettlementMarker.mat", SelectionMatPath = "Assets/Materials/HexSelection.mat", SeaMatPath = "Assets/Materials/Sea.mat";
[SetUp] public void FreshScene() => EditorSceneManager.NewScene(NewSceneSetup.EmptyScene, NewSceneMode.Single);
@@ -142,7 +143,7 @@ public class MapSceneTests
{
if (withCamera) new GameObject("TestMainCamera") { tag = "MainCamera" }.AddComponent<Camera>();
var map = new GameObject("MapScene").AddComponent<MapScene>();
- map.Configure(Load(TerrainMatPath), Load(OverlayMatPath), Load(MarkerMatPath), Load(SelectionMatPath));
+ map.Configure(Load(TerrainMatPath), Load(OverlayMatPath), Load(MarkerMatPath), Load(SelectionMatPath), Load(SeaMatPath));
return map;
}
@@ -179,6 +180,67 @@ public class MapSceneTests
Assert.Less(cam.ViewportPointToRay(new Vector3(x, 1f, 0)).direction.y, 0f, $"top edge at x={x} looks down");
}
+ /// <summary>Fix round 1 (review M7, the sea seam): a lit sea plane at sea level, under the terrain, carries the sea past
+ /// the map's edge, drawn with the editor-made Sea.mat (URP Lit, the sea biome colour, matte like the terrain).</summary>
+ [Test]
+ public void ASeaPlaneCarriesTheSeaPastTheTerrain()
+ {
+ var map = NewMap(); map.Build();
+ var plane = map.Terrain.transform.Find(MapScene.SeaPlaneName);
+ Assert.IsNotNull(plane, "the sea plane exists");
+ var mr = plane.GetComponent<MeshRenderer>();
+ var sea = Load(SeaMatPath);
+ Assert.AreSame(sea, mr.sharedMaterial, "the editor-made sea material, not an instance");
+ Assert.AreEqual("Universal Render Pipeline/Lit", sea.shader.name, "lit like the terrain");
+ var c = sea.GetColor("_BaseColor"); var want = MapBuilder.BiomeColours["sea"];
+ Assert.Less(Mathf.Abs(c.r - want.r) + Mathf.Abs(c.g - want.g) + Mathf.Abs(c.b - want.b), 1e-3f, "the sea biome colour");
+ var size = map.Terrain.terrainData.size;
+ var b = mr.bounds;
+ Assert.Less(b.min.x, -400000f); Assert.Greater(b.max.x, size.x + 400000f);
+ Assert.Less(b.min.z, -400000f); Assert.Greater(b.max.z, size.z + 400000f);
+ var seaHex = System.Array.Find(map.Hexes.hexes, h => h.biome == "sea");
+ var seaY = map.Terrain.SampleHeight(map.Frame.ToWorld(seaHex.lon, seaHex.lat, 0));
+ Assert.Less(b.max.y, seaY, "under the terrain's sea, so the terrain draws inside its bounds");
+ Assert.Greater(b.max.y, seaY - 100f, "at sea level");
+ }
+
+ /// <summary>Fix round 1 (the sea seam), rendered: at the west and north-west edges of the map, the sea on the terrain and
+ /// the sea beyond it come out the same colour (the scene's own light, camera rig and post-processing).</summary>
+ [UnityTest]
+ public System.Collections.IEnumerator TheSeaBeyondTheEdgeMatchesTheTerrainSea()
+ {
+ EditorSceneManager.OpenScene("Assets/Map.unity", OpenSceneMode.Single);
+ var map = Object.FindFirstObjectByType<MapScene>();
+ map.Build();
+ var cam = Camera.main; var rig = cam.GetComponent<CameraRig>();
+ var size = map.Terrain.terrainData.size;
+ var rt = new RenderTexture(1600, 900, 24);
+ var tex = new Texture2D(rt.width, rt.height, TextureFormat.RGB24, false);
+ try
+ {
+ foreach (var (look, inside, beyond) in new[] {
+ (new Vector3(3000, 0, size.z * 0.55f), new Vector3(2500, 0, size.z * 0.55f), new Vector3(-2500, 0, size.z * 0.55f)),
+ (new Vector3(3000, 0, size.z - 3000), new Vector3(2500, 0, size.z - 2500), new Vector3(-2500, 0, size.z + 2500)) })
+ {
+ rig.LookAt = look; rig.Distance = 120000f; rig.Yaw = 0; rig.Apply();
+ cam.targetTexture = rt;
+ yield return null;
+ cam.Render();
+ RenderTexture.active = rt;
+ tex.ReadPixels(new Rect(0, 0, rt.width, rt.height), 0, 0); tex.Apply();
+ // Project while the camera still renders into the texture, so the points are in its pixels.
+ Color Px(Vector3 w) { var p = cam.WorldToScreenPoint(w); return tex.GetPixel((int)p.x, (int)p.y); }
+ var a = Px(new Vector3(inside.x, map.Terrain.SampleHeight(inside), inside.z));
+ var b = Px(new Vector3(beyond.x, map.Terrain.SampleHeight(inside), beyond.z));
+ RenderTexture.active = null; cam.targetTexture = null;
+ var diff = Mathf.Abs(a.r - b.r) + Mathf.Abs(a.g - b.g) + Mathf.Abs(a.b - b.b);
+ TestContext.WriteLine($"seam at {look}: terrain sea {a}, beyond {b}, difference {diff:0.000}");
+ Assert.Less(diff, 0.012f, $"seam at {look}: terrain sea {a}, beyond {b}");
+ }
+ }
+ finally { rt.Release(); Object.DestroyImmediate(rt); Object.DestroyImmediate(tex); }
+ }
+
/// <summary>Playtest 1, item 3: with the top bar covering the top <c>TopInset</c> of the screen, the look-at point is
/// framed in the middle of the map area below the bar, not in the middle of the whole screen.</summary>
[Test]
@@ -251,12 +313,15 @@ public class MapSceneTests
public void BuildWithoutMaterialsNamesTheMissingField()
{
var map = new GameObject("MapScene").AddComponent<MapScene>();
- map.Configure(Load(TerrainMatPath), Load(OverlayMatPath), null, Load(SelectionMatPath));
+ map.Configure(Load(TerrainMatPath), Load(OverlayMatPath), null, Load(SelectionMatPath), Load(SeaMatPath));
var ex = Assert.Throws<System.InvalidOperationException>(() => map.Build());
StringAssert.Contains("markerMaterial", ex.Message);
- map.Configure(Load(TerrainMatPath), Load(OverlayMatPath), Load(MarkerMatPath), null);
+ map.Configure(Load(TerrainMatPath), Load(OverlayMatPath), Load(MarkerMatPath), null, Load(SeaMatPath));
ex = Assert.Throws<System.InvalidOperationException>(() => map.Build());
StringAssert.Contains("selectionMaterial", ex.Message);
+ map.Configure(Load(TerrainMatPath), Load(OverlayMatPath), Load(MarkerMatPath), Load(SelectionMatPath), null);
+ ex = Assert.Throws<System.InvalidOperationException>(() => map.Build());
+ StringAssert.Contains("seaMaterial", ex.Message);
}
[Test]
@@ -283,7 +348,7 @@ public class MapSceneTests
var map = NewMap(); map.Build();
var go = map.gameObject; Object.DestroyImmediate(map);
var fresh = go.AddComponent<MapScene>();
- fresh.Configure(Load(TerrainMatPath), Load(OverlayMatPath), Load(MarkerMatPath), Load(SelectionMatPath));
+ fresh.Configure(Load(TerrainMatPath), Load(OverlayMatPath), Load(MarkerMatPath), Load(SelectionMatPath), Load(SeaMatPath));
fresh.Build();
AssertOneOfEach();
}