Impl. global unit count increasement functionality after each round
This commit is contained in:
parent
f0a5f5d15c
commit
96eb25de65
@ -125,6 +125,27 @@ class RoundCalculatorService {
|
|||||||
DataService.sharedInstance.localRoundData.localPlayerMoves.removeAll()
|
DataService.sharedInstance.localRoundData.localPlayerMoves.removeAll()
|
||||||
DataService.sharedInstance.localRoundData.hasAttackBoost = false
|
DataService.sharedInstance.localRoundData.hasAttackBoost = false
|
||||||
DataService.sharedInstance.localRoundData.hasDefenceBoost = false
|
DataService.sharedInstance.localRoundData.hasDefenceBoost = false
|
||||||
|
var player1BaseCount = 0;
|
||||||
|
var player2BaseCount = 0;
|
||||||
|
let player1 = Array(allPlayerMoves)[0].key
|
||||||
|
let player2 = Array(allPlayerMoves)[1].key
|
||||||
|
for baseEntry in currentSnapshotModel!.baseEntites {
|
||||||
|
if baseEntry.ownership == player1 {
|
||||||
|
player1BaseCount += 1
|
||||||
|
} else if baseEntry.ownership == player2 {
|
||||||
|
player2BaseCount += 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
currentSnapshotModel?.baseEntites = currentSnapshotModel!.baseEntites.map { (BaseEntityModel) -> BaseEntityModel in
|
||||||
|
if BaseEntityModel.ownership == player1 {
|
||||||
|
BaseEntityModel.unitCount += lround(Double(player1BaseCount / 2))
|
||||||
|
} else if BaseEntityModel.ownership == player2 {
|
||||||
|
BaseEntityModel.unitCount += lround(Double(player2BaseCount / 2))
|
||||||
|
}
|
||||||
|
return BaseEntityModel
|
||||||
|
}
|
||||||
|
allPlayerMoves.removeAll()
|
||||||
|
DataService.sharedInstance.localPlayerMoves.removeAll()
|
||||||
MultiplayerNetwork.sharedInstance.sendSnapshotModelToPlayers()
|
MultiplayerNetwork.sharedInstance.sendSnapshotModelToPlayers()
|
||||||
DataService.sharedInstance.snapshotModel = currentSnapshotModel
|
DataService.sharedInstance.snapshotModel = currentSnapshotModel
|
||||||
entityManager.updateSnapshotModel(snapshotModel: currentSnapshotModel!)
|
entityManager.updateSnapshotModel(snapshotModel: currentSnapshotModel!)
|
||||||
|
Loading…
Reference in New Issue
Block a user