private static void BuildFleet(Scene scene, Fleet fleet, string teamName, uint team, Vector3 middle, Quaternion forward, Random rand, ISet <string> names) { var shipEntity = new SpaceShipEntity(scene.Kernel); foreach (var ship in fleet.Ships) { // Generate a unique name string name; do { name = ShipName.Generate(rand); } while (names.Contains(name)); names.Add(name); // Choose an offset var offset = new Vector3((float)rand.NextDouble(), (float)rand.NextDouble(), (float)rand.NextDouble()) * 2 - Vector3.One; offset *= 350; // Spawn ship entity var e = shipEntity.Create(name, teamName, team, middle + offset, Vector3.Zero, forward, new Vector3(0, 0, 0), ship.Programs); scene.Add(e); // Load up data var ctx = e.GetProperty(PropertyNames.YololContext)?.Value; if (ctx != null) { foreach (var(k, v) in fleet.Data) { ctx.Get(k).Value = v; } } } }
private static void Main(string[] args) { Console.WriteLine("Names:"); var r = new Random(); for (var i = 0; i < 15; i++) { Console.WriteLine(ShipName.Generate(r)); } Parser.Default.ParseArguments <Options>(args).WithParsed(Run); }