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.

2.3 KB
Raw Blame
#if UNITY_EDITOR
#nullable enable
using System;
using UnityEngine;

namespace Statecraft.Game.VehicleReview
{
    /// <summary>Only the owner's three generated vehicle candidates. Review labels are not sourced deployments.</summary>
    public sealed class VehicleReviewCatalog : ScriptableObject
    {
        public const string Folder = "Assets/Editor/Generated1948VehicleReview";
        public const string Path = Folder + "/Models.asset";
        public const string ScenePath = Folder + "/VehicleReview.unity";
        public static readonly string[] Ids = { "generated-1948-13-egyptian-spitfire", "generated-1948-14-syrian-renault-r35", "generated-1948-16-egyptian-dakota-c47" };
        /// <summary>A candidate placed in the game (#1932: the Spitfire; #2046: the R35, at Degania Alef from 20 May 1948; the
        /// Dakota off Tel Aviv, 15 May to 11 June 1948, owner, 2 November 2026) moved with git mv to the Collection folder; the
        /// review still shows it from there. The Spitfire's FBX was renamed to the Collection's id.fbx (the same bytes); the R35
        /// and the Dakota keep the delivery's -compatibility.fbx (CollectionCatalog.SourceModelPath).</summary>
        public static bool Placed(string id) => Map.Collection.CollectionCatalog.IsGenerated(id);
        public static string DirOf(string id) => (Placed(id) ? Map.Collection.CollectionCatalog.Folder : Folder) + "/" + id;
        public static string ModelOf(string id) =>
            Placed(id) ? Map.Collection.CollectionCatalog.SourceModelPath(id) : DirOf(id) + "/" + id + "-compatibility.fbx";
        [Serializable] public sealed class Entry
        {
            public string id = "", label = "";
            public GameObject model = null!;
            public float longSideM;
        }
        public Entry[] entries = Array.Empty<Entry>();
        public void Validate()
        {
            if (entries.Length != Ids.Length) throw new InvalidOperationException("Vehicle review needs exactly its three candidates.");
            for (int i = 0; i < entries.Length; i++)
                if (entries[i] == null || entries[i].id != Ids[i] || entries[i].model == null || entries[i].longSideM <= 0)
                    throw new InvalidOperationException("Incomplete vehicle review candidate " + Ids[i]);
        }
    }
}
#endif