public void _GameOver(){ TBData.ClearEndData(); //save the faction back to data if it's loaded from data for(int i=0; i<factionList.Count; i++){ Faction fac=factionList[i]; if(!fac.loadFromData) continue; List<TBDataUnit> startDataList=TBData.GetStartData(fac.dataID); List<TBDataUnit> list=new List<TBDataUnit>(); for(int m=0; m<startDataList.Count; m++){ for(int n=0; n<fac.allUnitList.Count; n++){ if(fac.allUnitList[n].GetDataID()==m){ list.Add(startDataList[m].Clone(fac.allUnitList[n])); fac.allUnitList.RemoveAt(n); break; } } } TBData.SetEndData(fac.dataID, list); } TBData.ClearStartData(); }
void Awake() { instance = this; TBData.ClearEndData(); SettingDB settingDB = InitSetting(); if (enableCover) { CoverSystem.SetFullCoverDodgeBonus(fullCoverBonus); CoverSystem.SetHalfCoverDodgeBonus(halfCoverBonus); CoverSystem.SetExposedCritChanceBonus(exposedCritBonus); } //get the instance of each component and initiate them, the order in which these component matters PerkManager perkManager = (PerkManager)FindObjectOfType(typeof(PerkManager)); if (perkManager != null) { perkManager.Init(); } AbilityManagerUnit abManagerUnit = (AbilityManagerUnit)FindObjectOfType(typeof(AbilityManagerUnit)); if (abManagerUnit != null) { abManagerUnit.Init(); } AbilityManagerFaction abManagerFac = (AbilityManagerFaction)FindObjectOfType(typeof(AbilityManagerFaction)); if (abManagerFac != null) { abManagerFac.Init(); } TurnControl turnControl = (TurnControl)FindObjectOfType(typeof(TurnControl)); turnControl.Init(); if (settingDB != null) { turnControl.turnMode = settingDB.turnMode; turnControl.moveOrder = settingDB.moveOrder; } GridManager gridManager = (GridManager)FindObjectOfType(typeof(GridManager)); if (settingDB != null) { gridManager.generateGridOnStart = settingDB.generateGridOnStart; } gridManager.Init(); FactionManager factionManager = (FactionManager)FindObjectOfType(typeof(FactionManager)); if (settingDB != null) { factionManager.generateUnitOnStart = settingDB.generateUnitOnStart; } factionManager.Init(); CollectibleManager collectibleManager = (CollectibleManager)FindObjectOfType(typeof(CollectibleManager)); if (settingDB != null) { collectibleManager.generateCollectibleOnStart = settingDB.generateCollectibleOnStart; } collectibleManager.Init(); GridManager.SetupGridForFogOfWar(); OverlayManager overlayManager = (OverlayManager)FindObjectOfType(typeof(OverlayManager)); overlayManager.Init(); defaultShootObject = Resources.Load("ScenePrefab/DefaultShootObject", typeof(GameObject)) as GameObject; gamePhase = _GamePhase.Initialization; }