private IEnumerator InitializeUnits(MissionMapData mapData) { _fightPreparationStep = EFightPreparationStep.InitializeUnits; _rtfUnitsAmount = 0; _alliesCount = 1; //hero for (int i = 0; i < Global.Instance.CurrentMission.SelectedSoldiers.Length; i++) { if (Global.Instance.CurrentMission.SelectedSoldiers[i] != null && !Global.Instance.CurrentMission.SelectedSoldiers[i].IsDead) { _alliesCount++; } } _enemiesCount = _graphics.EnemyUnits.Length; StartCoroutine(InitializeUnitsData(mapData)); while (_fightPreparationStep != EFightPreparationStep.UnitsGraphicsInitialized) { yield return(null); } UnitSet.Instance.SetUnitPositions(); _fightPreparationStep = EFightPreparationStep.UnitsInitialized; }
public IEnumerator LoadMap() { LoadingScreen.Instance.SetProgress(0.1f); _graphics.Unload(false); _logger.Clear(); MissionMapData mapData = _missionData.GetMap(_currentMapIndex); _fightPreparationStep = EFightPreparationStep.MapGraphicsLoad; _graphics.Load(mapData); yield return(null); _fightPreparationStep = EFightPreparationStep.MapGraphicsLoaded; StartCoroutine(InitializeUnits(mapData)); while (_fightPreparationStep != EFightPreparationStep.UnitsInitialized) { yield return(null); } _fightPreparationStep = EFightPreparationStep.End; StartCoroutine(PlayFightDialog()); _ui.HideFader(); }
public void StartFightPreparations() { _fightPreparationStep = EFightPreparationStep.Begin; _status = EFightStatus.Preparation; Global.Instance.Player.Heroes.Current.ResetDamageTaken(); Global.Instance.Player.Heroes.Current.ResetAggro(); StartCoroutine(LoadMap()); }
private IEnumerator InitializeUnitsData(MissionMapData mapData) { _fightPreparationStep = EFightPreparationStep.InitializeUnitsGraphics; float unitInitializationStep = (0.9f - 0.25f) / (_alliesCount + _enemiesCount); float currentLoadPercentage = 0.25f; //get player hero skills Dictionary<ESkillKey, BaseUnitSkill> playerHeroSkills = new Dictionary<ESkillKey, BaseUnitSkill>(); SkillParameters skillParams = SkillsConfig.Instance.HetHeroSkillParameters(Global.Instance.Player.Heroes.Current.Data.Key); if (skillParams != null) { playerHeroSkills.Add(skillParams.Key, SkillsConfig.Instance.GetSkillInstance(skillParams)); } ListRO<ESkillKey> playerHeroSkillKeys = Global.Instance.Player.HeroSkills.GetHeroSkills(Global.Instance.Player.Heroes.Current.Data.Key); for (int i = 0; i < playerHeroSkillKeys.Count; i++) { skillParams = SkillsConfig.Instance.GetSkillParameters(playerHeroSkillKeys[i]); if (skillParams != null) { playerHeroSkills.Add(skillParams.Key, SkillsConfig.Instance.GetSkillInstance(skillParams)); } } _graphics.AllyUnits[_graphics.AllyUnits.Length - 1].Setup(Global.Instance.Player.Heroes.Current, playerHeroSkills, GameConstants.Tags.UNIT_ALLY, _graphics.UnitUIResource, Global.Instance.CurrentMission.SelectedSoldiers.Length); for(int i = 0; i < Global.Instance.CurrentMission.SelectedSoldiers.Length; i++) { if (!Global.Instance.CurrentMission.SelectedSoldiers[i].IsDead) { _graphics.AllyUnits[i].Setup(Global.Instance.CurrentMission.SelectedSoldiers[i], null, GameConstants.Tags.UNIT_ALLY, _graphics.UnitUIResource, i); //TODO: setup units skills currentLoadPercentage += unitInitializationStep; LoadingScreen.Instance.SetProgress(currentLoadPercentage); yield return null; } } BaseUnitData bud = null; for (int i = 0; i < mapData.Units.Length; i++) { bud = UnitsConfig.Instance.GetUnitData(mapData.Units[i]); if (bud is BaseHeroData) { _graphics.EnemyUnits[i].Setup(new BaseHero(bud as BaseHeroData, 0), null, GameConstants.Tags.UNIT_ENEMY, _graphics.UnitUIResource, i); //TODO: setup enemy hero inventory, hero skills } else { _graphics.EnemyUnits[i].Setup(new BaseSoldier(bud as BaseSoldierData, 1), null, GameConstants.Tags.UNIT_ENEMY, _graphics.UnitUIResource, i); //TODO: setup enemy soldier upgrades, unit skills } currentLoadPercentage += unitInitializationStep; LoadingScreen.Instance.SetProgress(currentLoadPercentage); yield return null; } _fightPreparationStep = EFightPreparationStep.UnitsGraphicsInitialized; }
private IEnumerator InitializeUnits(MissionMapData mapData) { _fightPreparationStep = EFightPreparationStep.InitializeUnits; _rtfUnitsAmount = 0; _alliesCount = 1; //hero for (int i = 0; i < Global.Instance.CurrentMission.SelectedSoldiers.Length; i++) { if (Global.Instance.CurrentMission.SelectedSoldiers[i] != null && !Global.Instance.CurrentMission.SelectedSoldiers[i].IsDead) { _alliesCount++; } } _enemiesCount = _graphics.EnemyUnits.Length; StartCoroutine(InitializeUnitsData(mapData)); while (_fightPreparationStep != EFightPreparationStep.UnitsGraphicsInitialized) { yield return null; } UnitSet.Instance.SetUnitPositions(); _fightPreparationStep = EFightPreparationStep.UnitsInitialized; }
public IEnumerator LoadMap() { LoadingScreen.Instance.SetProgress(0.1f); _graphics.Unload(false); _logger.Clear(); MissionMapData mapData = _missionData.GetMap(_currentMapIndex); _fightPreparationStep = EFightPreparationStep.MapGraphicsLoad; _graphics.Load(mapData); yield return null; _fightPreparationStep = EFightPreparationStep.MapGraphicsLoaded; StartCoroutine(InitializeUnits(mapData)); while (_fightPreparationStep != EFightPreparationStep.UnitsInitialized) { yield return null; } _fightPreparationStep = EFightPreparationStep.End; StartCoroutine(PlayFightDialog()); _ui.HideFader(); }
private IEnumerator InitializeUnitsData(MissionMapData mapData) { _fightPreparationStep = EFightPreparationStep.InitializeUnitsGraphics; float unitInitializationStep = (0.9f - 0.25f) / (_alliesCount + _enemiesCount); float currentLoadPercentage = 0.25f; //get player hero skills Dictionary <ESkillKey, BaseUnitSkill> playerHeroSkills = new Dictionary <ESkillKey, BaseUnitSkill>(); SkillParameters skillParams = SkillsConfig.Instance.HetHeroSkillParameters(Global.Instance.Player.Heroes.Current.Data.Key); if (skillParams != null) { playerHeroSkills.Add(skillParams.Key, SkillsConfig.Instance.GetSkillInstance(skillParams)); } ListRO <ESkillKey> playerHeroSkillKeys = Global.Instance.Player.HeroSkills.GetHeroSkills(Global.Instance.Player.Heroes.Current.Data.Key); for (int i = 0; i < playerHeroSkillKeys.Count; i++) { skillParams = SkillsConfig.Instance.GetSkillParameters(playerHeroSkillKeys[i]); if (skillParams != null) { playerHeroSkills.Add(skillParams.Key, SkillsConfig.Instance.GetSkillInstance(skillParams)); } } _graphics.AllyUnits[_graphics.AllyUnits.Length - 1].Setup(Global.Instance.Player.Heroes.Current, playerHeroSkills, GameConstants.Tags.UNIT_ALLY, _graphics.UnitUIResource, Global.Instance.CurrentMission.SelectedSoldiers.Length); for (int i = 0; i < Global.Instance.CurrentMission.SelectedSoldiers.Length; i++) { if (!Global.Instance.CurrentMission.SelectedSoldiers[i].IsDead) { _graphics.AllyUnits[i].Setup(Global.Instance.CurrentMission.SelectedSoldiers[i], null, GameConstants.Tags.UNIT_ALLY, _graphics.UnitUIResource, i); //TODO: setup units skills currentLoadPercentage += unitInitializationStep; LoadingScreen.Instance.SetProgress(currentLoadPercentage); yield return(null); } } BaseUnitData bud = null; for (int i = 0; i < mapData.Units.Length; i++) { bud = UnitsConfig.Instance.GetUnitData(mapData.Units[i]); if (bud is BaseHeroData) { _graphics.EnemyUnits[i].Setup(new BaseHero(bud as BaseHeroData, 0), null, GameConstants.Tags.UNIT_ENEMY, _graphics.UnitUIResource, i); //TODO: setup enemy hero inventory, hero skills } else { _graphics.EnemyUnits[i].Setup(new BaseSoldier(bud as BaseSoldierData, 1), null, GameConstants.Tags.UNIT_ENEMY, _graphics.UnitUIResource, i); //TODO: setup enemy soldier upgrades, unit skills } currentLoadPercentage += unitInitializationStep; LoadingScreen.Instance.SetProgress(currentLoadPercentage); yield return(null); } _fightPreparationStep = EFightPreparationStep.UnitsGraphicsInitialized; }