/// <summary> /// Initializes control elements of the game. Loads given mission, creates all required game objects /// (and sets DieHandler) and registers them to control elements. /// </summary> /// <param name="missionName">The name of the choosen mission.</param> public void Initialize(string missionName) { // Creates game objects objectCreator.InitializeWorld(missionName); // Sets DieHandler foreach (var solarSys in objectCreator.GetInicializedSolarSystems()) { foreach (var gameObject in solarSys.GetIMGOs()) { gameObject.Value.DieHandler += OnDieEvent; } foreach (var gameObject in solarSys.GetISGOs()) { gameObject.Value.DieHandler += OnDieEvent; } } // Registers SolarSystems solarSystemMgr.CreateSolarSystems(objectCreator.GetInicializedSolarSystems()); // Initializes HitTest hitTest.CreateHitTestMap(objectCreator.GetInicializedSolarSystems()); // Registers team teamMgr.Initialize(objectCreator.GetTeams(), objectCreator.GetTeamsRelations()); groupMgr.UntargetGroup(); // Initializes movements and fights (occupations) from XML file moveMgr.Initialize(objectCreator.GetLoadedMovements()); fightMgr.Initialize(objectCreator.GetLoadedOccupations(), objectCreator.GetLoadedFights()); gameSerializer.Initialize(missionName); }