public void CreateLevel(string levelName) { IMapSerializator serializator = new FileMapSerializator(levelName); m_Map = serializator.LoadMap(); LoaderMap.CreateMap(m_Map, false); CarSurface surface = new CarSurface(); surface.AddSurface(0, 5f, 1); surface.AddSurface(1, 3f, 0.7f); ICarFactory carFactory = new DefaultCarFactory(); ICar car = carFactory.CreateCar(10, 90, surface); m_Game = new Game(); m_RewardManager = new RewardManager(30, 40); Vector3 carPos = LoaderMap.GetCheckPoint(0).transform.position; m_UnityCar = LoaderCar.CreateCar(m_Game, car, carPos, Vector3.one * 0.5f); m_CheckPointReachChecker = new CheckPointReachChecker(m_UnityCar.transform); m_Game.Start(Time.time); }
public void LoadMap(string mapName) { if (m_IsLevelLoaded) { ClearLevel(); } IMapSerializator serializator = new FileMapSerializator(mapName); m_Map = serializator.LoadMap(); LoaderOfMap.CreateMap(m_Map, true); AssignCellParams(); m_IsLevelLoaded = true; }
public void SaveMap(string mapName) { IMapSerializator serializator = new FileMapSerializator(mapName); serializator.SaveMap(m_Map); }