private void Update() { if (populationOperations.Count > 0) { popOp tempPopOP = populationOperations.Dequeue(); switch (tempPopOP.type) { #region InvadingForce case popOpType.InvadingForce: if (tempPopOP.unitsTeam.Equals(currentTeam)) { population += tempPopOP.amountChanged; } else { if (population - tempPopOP.amountChanged < 0) { changeTeamTo(tempPopOP.unitsTeam); makeCorrectTeamSprite(); population = tempPopOP.amountChanged - population; } else { population -= tempPopOP.amountChanged; } } break; #endregion #region LeavingForce case popOpType.LeavingForce: if (tempPopOP.unitsTeam.Equals(currentTeam)) { population -= tempPopOP.amountChanged; } break; #endregion #region BombstrikeOnBase case popOpType.BombstrikeOnBase: //Debug.Log("Before: " + population); if (population - tempPopOP.amountChanged <= 0) { population = 1; } else { population -= tempPopOP.amountChanged; } //Debug.Log("After: " + population); break; #endregion #region NewSoldierBorn case popOpType.NewSoldierBorn: population++; break; #endregion #region SoldierStarvedToDeath case popOpType.SoldierStarvedToDeath: population--; break; #endregion } updatePopulationDisplay(); } }
public void affectPopulation(popOp populationOperation) { populationOperations.Enqueue(populationOperation); }