private void SetUpFlags(BattleInformation battleInformation) { switch (battleInformation.attackingKingdom) { case Kingdom.Blue: scoreFlags[0].sprite = blueFlag; break; case Kingdom.Green: scoreFlags[0].sprite = greenFlag; break; case Kingdom.Orange: scoreFlags[0].sprite = orangeFlag; break; case Kingdom.Purple: scoreFlags[0].sprite = purpleFlag; break; case Kingdom.Red: scoreFlags[0].sprite = redFlag; break; } switch (battleInformation.defendingKingdom) { case Kingdom.Blue: scoreFlags[1].sprite = blueFlag; break; case Kingdom.Green: scoreFlags[1].sprite = greenFlag; break; case Kingdom.Orange: scoreFlags[1].sprite = orangeFlag; break; case Kingdom.Purple: scoreFlags[1].sprite = purpleFlag; break; case Kingdom.Red: scoreFlags[1].sprite = redFlag; break; } }
private IEnumerator IndividualBattle(Property property, BattleInformation battleInformation) { var cam = Camera.main.GetComponent <CameraMovement>(); yield return(cam.FollowPosition(property.gameObject.transform.position)); yield return(cam.Zoom(true)); int attackerSoldiers = battleInformation.attackingSoldiers; int defenderSoldiers = battleInformation.defendingSoldiers; int attackerBattlePoints; int defenderBattlePoints; int remainingAttackerSoldiers; int remainingDefenderSoldiers; SimulateBattle(attackerSoldiers, defenderSoldiers, out remainingAttackerSoldiers, out remainingDefenderSoldiers, out attackerBattlePoints, out defenderBattlePoints); battleWindow.Show(attackerSoldiers, defenderSoldiers, attackerBattlePoints, defenderBattlePoints, battleInformation, remainingAttackerSoldiers, remainingDefenderSoldiers, (battleInformation.attackingKingdom == StartingKingdomController.Instance.PlayerKingdom)); if (InvaderIsTheWinner(remainingAttackerSoldiers, remainingDefenderSoldiers)) { if (property.dominated) { numberOfBattlesLostByThePlayerLastTurn++; } else { numberOfBattlesWonByThePlayerLastTurn++; } property.SetDominated(!property.dominated, false); property.SetSoldiers(SoldierType.InProperty, remainingAttackerSoldiers); if (!property.mainProperty) { property.WeakenCastle(); } property.ChangeKingdom(battleInformation.attackingKingdom); } else { if (!property.dominated) { numberOfBattlesLostByThePlayerLastTurn++; } else { numberOfBattlesWonByThePlayerLastTurn++; } property.SetSoldiers(SoldierType.InProperty, remainingDefenderSoldiers); } property.SetSoldiers(SoldierType.Enemy, 0); yield return(battleWindow.currentBattle); yield return(cam.Zoom(false)); property.UpdateSoldierInfo(); property.UpdateSprite(property); }
public void AddSoldiers(SoldierType type, int SoldiersToAdd, BattleInformation battleInformation) { AddSoldiers(type, SoldiersToAdd); if (SoldiersToAdd > 0 && type == SoldierType.Enemy) { attackInformation = battleInformation; } }
public void AddBattleProperty(Property prop, BattleInformation attackInformation) { if (propertiesInBattle == null) { ResetBattleList(); } propertiesInBattle.Add(prop); battleInformations.Add(attackInformation); }
private void OnAfterDayEnd() { soldiers -= SoldiersToGetOut; SoldiersToGetOut = 0; UpdateSoldierInfo(); if (EnemySoldiers > 0) { attackInformation.attackingSoldiers = EnemySoldiers; // bug fix para quando várias propriedades atacam o mesmo alvo FindObjectOfType <BattleManager>().AddBattleProperty(this, attackInformation); } attackInformation = null; }
public void Show(int attackerSoldiers, int defenderSoldiers, int attackerBattlePoints, int defenderBattlePoints, BattleInformation battleInformation, int remainingAttackerSoldiers, int remainingDefenderSoldiers, bool playerIsAttacking) { GetComponent <CanvasGroup>().DOFade(1, 0); this.attackerSoldiers = attackerSoldiers; this.defenderSoldiers = defenderSoldiers; this.attackerBattlePoints = attackerBattlePoints; this.defenderBattlePoints = defenderBattlePoints; this.remainingAttackerSoldiers = remainingAttackerSoldiers; this.remainingDefenderSoldiers = remainingDefenderSoldiers; this.playerIsAttacking = playerIsAttacking; SetUpFlags(battleInformation); currentBattle = StartCoroutine(ShowBattleScene()); }