protected async override Task ExecuteAsync() { Console.WriteLine("Starting Herd"); var herd = new Shepherd(Root.Connection, "", worldKey: World); var configMonster = new ConfigMonster(); configMonster.Configure(File); var baseMonsterType = Type.GetType(configMonster.RobotType); var parent = Activator.CreateInstance(baseMonsterType, herd) as ConfigMonster; if (File != null) { parent.Configure(File); } await herd.StartRobot(parent); await parent.SpawnAsync(); Console.ReadLine(); }
protected async Task <T> SpawnChildAsync <T>(string config = null, Vector2 relativePosition = default) where T : ConfigMonster { var child = Activator.CreateInstance(typeof(T), Tender) as T; if (this.SensorFleets != null) { Console.WriteLine($"Spawning Child at : {SensorFleets.LastKnownCenter}"); child.NextPosition = this.SensorFleets.LastKnownCenter + relativePosition; } if (config != null) { child.Configure(config); } await Tender.StartRobot(child); await child.SpawnAsync(); return(child); }