//this sends the gameboard to each bar so they can update their counts/fill/button-enabledness public void UpdateFactionProgress(FactionProgress fp, CellStruct[,] playerState, CellStruct[,] enemyState) { foreach (ActionProgressBar bar in this.bars) { bar.UpdateBar(fp, playerState, enemyState); } }
public void UpdateBar(FactionProgress fp, CellStruct[,] playerState, CellStruct[,] enemyState) { int boardCount = GUtils.Serialize(playerState).Count(cell => cell.bldg == this.displayBldg && !cell.destroyed && !cell.defected); //count all friendly spaces not taken over boardCount += GUtils.Serialize(enemyState).Count(cell => cell.bldg == this.displayBldg && !cell.destroyed && cell.defected); //count all enemy spaces taken over this.countText.text = boardCount.ToString(); //Fill the bar based on total progress int count = fp.GetProgress(this.faction); this.fill.fillAmount = (float)count / this.maxInterval; }
public void ActionSelectGroupUpdateFactionProgress(FactionProgress factionProgress, CellStruct[,] playerState, CellStruct[,] enemyState) { this.asg.UpdateFactionProgress(factionProgress, playerState, enemyState); }