public void LoadStateOfMap() { UpdateTimeDisplay(); FindObjectOfType <MovingPlayer>().transform.position = posHerald; var tavernsOnMap = FindObjectsOfType <TavernOnMap>(); var tavernData = dataModel.GetComponent <DataModal>().TavernData; foreach (var tavern in tavernsOnMap) { var data = dataModel.TavernData.Find(x => x.TavernID == tavern.id); tavern.types = data.Heroes.ToArray(); tavern.averageLevel = data.AveragePowerLevel; tavern.heroes = tavernHeroes[tavern.id]; tavern.Revealed = tavernRevealed[tavern.id]; } }
//Initializes the game for each level. void InitGame() { tavernRevealed = new Dictionary <int, bool>(); tavernHeroes = new Dictionary <int, List <Hero> >(); dataModel = GameObject.Find("DataModal").GetComponent <DataModal>(); dataModel.Load(); missionNumber = 1; activeQuests = dataModel.GetAllQuestForAMission(missionNumber); TimeElapsed = 6; UpdateTimeDisplay(); var tavernData = dataModel.GetComponent <DataModal>().TavernData; var tavernsOnMap = FindObjectsOfType <TavernOnMap>(); foreach (var tavern in tavernsOnMap) { var data = dataModel.TavernData.Find(x => x.TavernID == tavern.id); tavern.types = data.Heroes.ToArray(); tavern.averageLevel = data.AveragePowerLevel; } }