/// <summary> /// Sets the map. Please prefer using LoadMap(), as this method will not /// initialise neither navigation mesh nor collision manager! /// </summary> /// <param name="map"></param> public void SetMap(Map map) { mMap = map; if (map != null) SectorManager = new UnitSectorManager(map.GetWidth(), map.GetHeight()); else { SectorManager = null; } }
/// <summary> /// Initializes game from a given map /// </summary> /// <returns>returns true if successful, else false</returns> public void LoadMap(Map map) { UnloadGame(); GameLogic gameLogic = GameLogic.GetInstance(); gameLogic.SetMap(map); // already initialised sectorManager by setting new map //gameLogic.SectorManager = new UnitSectorManager(map.GetWidth(), map.GetHeight()); CollisionManager collisionManager = new CollisionManager(); collisionManager.Init(); gameLogic.SetCollisionManager(collisionManager); gameLogic.SuperFogManager = new SuperFogManager(); PlayerFogManager playerFogManager = new PlayerFogManager(); playerFogManager.Init(); gameLogic.SuperFogManager.PlayerFogManager = playerFogManager; PcFogManager pcFogManager = new PcFogManager(); pcFogManager.Init(); gameLogic.SuperFogManager.PcFogManager = pcFogManager; GameObjectManager objectManager = GameObjectManager.GetInstance(); IEnumerable<GameObject> list = map.GetGameObjects(); foreach (GameObject obj in list) { objectManager.AddUnit(obj); } Debug.Assert(map != null); PathFinder.GetInstance().LoadMeshFromObstructions(map.GetWidth(), map.GetHeight(), GlobalValues.GetInstance().MeshScale); // hinzugefügt von jonas (ka ob das wo besser passt) view.HumanView.GetInstance().GetRenderer().GetCamera().SetBoundaries(new Rectangle(0, 0, map.GetWidth(), map.GetHeight())); }