Exemplo n.º 1
0
		private void ChooseInitialCardsForNextFaction() {
			++cardChoosingFactionIdx;
			if (cardChoosingFactionIdx < factionList.Count) {
				Debug.LogWarning("Choosing cards for faction " + cardChoosingFactionIdx);
				if(factionList[cardChoosingFactionIdx].isPlayerFaction){
					// Debug.LogWarning("deck size = " + factionList[cardChoosingFactionIdx].allUnitList.Select(unit => unit.reserveAbilityIDList.Count).Sum());
					numAbilitiesChosen = 0;
					abilitySelections = new List<Unit.AbilitySelection>();
					for (int i = 0; i < abilitySelectionButtons.Count; ++i)
					{
						// Debug.LogWarning("Choosing card  " + i);
						Unit.AbilitySelection abilitySelection = Unit.DrawCard(factionList[cardChoosingFactionIdx].allUnitList);
						abilitySelections.Add(abilitySelection);
						if (abilitySelection != null){
							// Debug.LogWarning("selection  " + abilitySelection.abilityId + " " + abilitySelection.cardOwner.unitName);
							UnitAbility ability=AbilityManagerUnit.GetAbilityBasedOnID(abilitySelection.abilityId);
							abilitySelectionButtons[i].Init();
							// Debug.LogWarning("ability = " + ability.name);
							// Debug.LogWarning(abilitySelectionButtons[i]);
							// Debug.LogWarning(abilitySelectionButtons[i].imgIcon);
							// Debug.LogWarning(abilitySelectionButtons[i].label);
							abilitySelectionButtons[i].imgIcon.sprite= ability.icon;
							abilitySelectionButtons[i].label.text = ability.GetCost().ToString();
							abilitySelectionButtons[i].SetActive(true);	
						}
					}
					chooseInitialCardsUI.gameObject.SetActive(true);
				} else {
					ChooseInitialCardsForNextFaction();
				}				
			} else {
				chooseInitialCardsUI.gameObject.SetActive(false);
				GameControl.OnFinishedCardChoice();
			}
		}