public void UpdateArmyTable() { App app = UnityEngine.Object.FindObjectOfType <App>(); Nation player = State.getNations()[app.GetHumanIndex()]; MilitaryForm militaryForm = player.GetMilitaryForm(); Text infantryAttack = armyTable.Rows[1].Cells[1].GetComponentInChildren <Text>(); infantryAttack.text = militaryForm.infantry.AttackStrength.ToString(); Text cavAttack = armyTable.Rows[1].Cells[2].GetComponentInChildren <Text>(); cavAttack.text = militaryForm.cavalry.AttackStrength.ToString(); Text artAttack = armyTable.Rows[1].Cells[3].GetComponentInChildren <Text>(); artAttack.text = militaryForm.artillery.AttackStrength.ToString(); Text fighterAttack = armyTable.Rows[1].Cells[4].GetComponentInChildren <Text>(); fighterAttack.text = militaryForm.fighter.AttackStrength.ToString(); Text tankAttack = armyTable.Rows[1].Cells[5].GetComponentInChildren <Text>(); tankAttack.text = militaryForm.tank.AttackStrength.ToString(); Text infantryDefend = armyTable.Rows[2].Cells[1].GetComponentInChildren <Text>(); infantryDefend.text = militaryForm.infantry.DefenseStrength.ToString(); Text cavDefend = armyTable.Rows[2].Cells[2].GetComponentInChildren <Text>(); cavDefend.text = militaryForm.cavalry.DefenseStrength.ToString(); Text artDefend = armyTable.Rows[2].Cells[3].GetComponentInChildren <Text>(); artDefend.text = militaryForm.artillery.DefenseStrength.ToString(); Text fighterDefend = armyTable.Rows[2].Cells[4].GetComponentInChildren <Text>(); fighterDefend.text = militaryForm.fighter.DefenseStrength.ToString(); Text tankDefend = armyTable.Rows[2].Cells[5].GetComponentInChildren <Text>(); tankDefend.text = militaryForm.tank.DefenseStrength.ToString(); Text InfantryShock = armyTable.Rows[3].Cells[1].GetComponentInChildren <Text>(); InfantryShock.text = militaryForm.infantry.Shock.ToString(); Text CavShock = armyTable.Rows[3].Cells[2].GetComponentInChildren <Text>(); CavShock.text = militaryForm.cavalry.Shock.ToString(); Text ArtShock = armyTable.Rows[3].Cells[3].GetComponentInChildren <Text>(); ArtShock.text = militaryForm.artillery.Shock.ToString(); Text FighterShock = armyTable.Rows[3].Cells[4].GetComponentInChildren <Text>(); FighterShock.text = militaryForm.fighter.Shock.ToString(); Text TankShock = armyTable.Rows[3].Cells[5].GetComponentInChildren <Text>(); TankShock.text = militaryForm.tank.Shock.ToString(); Text InfantryAmmo = armyTable.Rows[4].Cells[1].GetComponentInChildren <Text>(); InfantryAmmo.text = militaryForm.infantry.AmmoUse.ToString(); Text CavAmmo = armyTable.Rows[4].Cells[2].GetComponentInChildren <Text>(); CavAmmo.text = militaryForm.cavalry.AmmoUse.ToString(); Text ArtAmmo = armyTable.Rows[4].Cells[3].GetComponentInChildren <Text>(); ArtAmmo.text = militaryForm.artillery.AmmoUse.ToString(); Text FighterAmmo = armyTable.Rows[4].Cells[4].GetComponentInChildren <Text>(); FighterAmmo.text = militaryForm.fighter.AmmoUse.ToString(); Text TankAmmo = armyTable.Rows[4].Cells[5].GetComponentInChildren <Text>(); TankAmmo.text = militaryForm.tank.AmmoUse.ToString(); Text InfantryOil = armyTable.Rows[6].Cells[1].GetComponentInChildren <Text>(); InfantryOil.text = militaryForm.infantry.OilUse.ToString(); // Debug.Log("Infantry Oiluse " + militaryForm.infantry.OilUse.ToString()); Text CavOil = armyTable.Rows[5].Cells[2].GetComponentInChildren <Text>(); CavOil.text = militaryForm.cavalry.OilUse.ToString(); Text ArtOil = armyTable.Rows[5].Cells[3].GetComponentInChildren <Text>(); CavOil.text = militaryForm.artillery.OilUse.ToString(); Text FighterOil = armyTable.Rows[5].Cells[4].GetComponentInChildren <Text>(); FighterOil.text = militaryForm.fighter.OilUse.ToString(); Text TankOil = armyTable.Rows[5].Cells[5].GetComponentInChildren <Text>(); TankOil.text = militaryForm.tank.OilUse.ToString(); Text InfWeight = armyTable.Rows[5].Cells[1].GetComponentInChildren <Text>(); InfantryOil.text = militaryForm.infantry.Weight.ToString(); // Debug.Log("Infantry Weight: " + militaryForm.infantry.Weight.ToString()); Text CavWeight = armyTable.Rows[6].Cells[2].GetComponentInChildren <Text>(); CavWeight.text = militaryForm.cavalry.Weight.ToString(); Text ArtWeight = armyTable.Rows[6].Cells[3].GetComponentInChildren <Text>(); ArtWeight.text = militaryForm.artillery.Weight.ToString(); Text FighterWeight = armyTable.Rows[6].Cells[4].GetComponentInChildren <Text>(); FighterWeight.text = militaryForm.fighter.Weight.ToString(); Text TankWeight = armyTable.Rows[6].Cells[5].GetComponentInChildren <Text>(); TankWeight.text = militaryForm.tank.Weight.ToString(); Text NumInf = armyTable.Rows[7].Cells[1].GetComponentInChildren <Text>(); Text NumArt = armyTable.Rows[7].Cells[2].GetComponentInChildren <Text>(); Text NumCav = armyTable.Rows[7].Cells[3].GetComponentInChildren <Text>(); Text NumFight = armyTable.Rows[7].Cells[4].GetComponentInChildren <Text>(); Text NumTank = armyTable.Rows[7].Cells[5].GetComponentInChildren <Text>(); float infantryCount = 0; float artilleryCount = 0; float cavalryCount = 0; float fighterCount = 0; float tankCount = 0; for (int i = 0; i < player.GetArmies().Count; i++) { infantryCount += player.GetArmy(i).GetInfantry(); artilleryCount += player.GetArmy(i).GetArtillery(); cavalryCount += player.GetArmy(i).GetCavalry(); fighterCount += player.GetArmy(i).GetFighter(); tankCount += player.GetArmy(i).GetTank(); } NumInf.text = infantryCount.ToString(); NumArt.text = artilleryCount.ToString(); NumCav.text = cavalryCount.ToString(); NumFight.text = fighterCount.ToString(); NumTank.text = tankCount.ToString(); Text recInf = armyTable.Rows[8].Cells[1].GetComponentInChildren <Text>(); Text recArt = armyTable.Rows[8].Cells[2].GetComponentInChildren <Text>(); Text recCav = armyTable.Rows[8].Cells[3].GetComponentInChildren <Text>(); Text recFight = armyTable.Rows[8].Cells[4].GetComponentInChildren <Text>(); Text recTank = armyTable.Rows[8].Cells[5].GetComponentInChildren <Text>(); recInf.text = player.getArmyProducing(MyEnum.ArmyUnits.infantry).ToString(); recArt.text = player.getArmyProducing(MyEnum.ArmyUnits.artillery).ToString(); recCav.text = player.getArmyProducing(MyEnum.ArmyUnits.cavalry).ToString(); recFight.text = player.getArmyProducing(MyEnum.ArmyUnits.fighter).ToString(); recTank.text = player.getArmyProducing(MyEnum.ArmyUnits.tank).ToString(); Button recruitInfButton = armyTable.Rows[10].Cells[1].GetComponentInChildren <Button>(); if (player.getUrbanPOP() < 1 || player.getNumberGood(MyEnum.Goods.arms) < 1) { recruitInfButton.interactable = false; } else { recruitInfButton.interactable = true; } Button recruitArtButton = armyTable.Rows[10].Cells[3].GetComponentInChildren <Button>(); if (player.getUrbanPOP() < 1 || player.getNumberGood(MyEnum.Goods.arms) < 2) { recruitArtButton.interactable = false; } else { recruitArtButton.interactable = true; } Button recruitCavButton = armyTable.Rows[10].Cells[2].GetComponentInChildren <Button>(); if (player.getUrbanPOP() < 1 || player.getNumberGood(MyEnum.Goods.arms) < 1 || player.getNumberResource(MyEnum.Resources.wheat) < 1) { recruitCavButton.interactable = false; } else { recruitCavButton.interactable = true; } Button recruitFighterButton = armyTable.Rows[10].Cells[4].GetComponentInChildren <Button>(); if (player.getUrbanPOP() < 1 || player.getNumberGood(MyEnum.Goods.fighter) < 1) { recruitFighterButton.interactable = false; } else { recruitFighterButton.interactable = true; } Button recruitTankButton = armyTable.Rows[10].Cells[5].GetComponentInChildren <Button>(); if (player.getUrbanPOP() < 1 || player.getNumberGood(MyEnum.Goods.tank) < 1) { recruitTankButton.interactable = false; } else { recruitTankButton.interactable = true; } }
public static void registerTechChanges(Technology tech, Nation player) { string techName = tech.GetTechName(); MilitaryForm militaryForm = player.GetMilitaryForm(); if (techName == "flintlock") { militaryForm.infantry.ImproveAttackStrength(0.25f); militaryForm.infantry.ImproveDefenseStrength(0.1f); militaryForm.cavalry.ImproveAttackStrength(0.25f); militaryForm.cavalry.ImproveDefenseStrength(0.1f); } if (techName == "square_timbering") { player.IncreaseMaxWareHouseCapacity(8); } if (techName == "cement") { player.IncreaseMaxFort(); player.IncreaseMaxWareHouseCapacity(8); } if (techName == "breech_loaded_arms") { militaryForm.infantry.ImproveAttackStrength(0.35f); militaryForm.infantry.ImproveDefenseStrength(0.2f); militaryForm.cavalry.ImproveAttackStrength(0.35f); militaryForm.cavalry.ImproveDefenseStrength(0.1f); militaryForm.artillery.ImproveAttackStrength(0.35f); militaryForm.artillery.ImproveDefenseStrength(0.2f); militaryForm.artillery.IncreaseShock(0.1f); militaryForm.artillery.IncreaseAmmoConsumption(0.05f); militaryForm.frigate.ImproveAttack(0.3f); } if (techName == "machine_guns") { militaryForm.infantry.ImproveAttackStrength(0.1f); militaryForm.infantry.ImproveAttackStrength(1.0f); militaryForm.cavalry.ImproveDefenseStrength(0.2f); militaryForm.ironclad.ImproveAttack(0.15f); militaryForm.infantry.IncreaseAmmoConsumption(0.075f); } if (techName == "indirect_fire") { militaryForm.artillery.ImproveAttackStrength(0.3f); militaryForm.artillery.ImproveDefenseStrength(0.6f); militaryForm.artillery.IncreaseShock(0.2f); militaryForm.ironclad.ImproveAttack(0.2f); militaryForm.artillery.IncreaseAmmoConsumption(0.1f); militaryForm.ironclad.IncreaseAmmoConsumption(0.1f); } if (techName == "advanced_iron_working") { player.IncreaseMaxWareHouseCapacity(8); } if (techName == "steel_armor") { militaryForm.ironclad.HitPoints = 3; } if (techName == "oil_powered_ships") { player.IncreaseMaxWareHouseCapacity(8); } if (techName == "bombers") { militaryForm.fighter.ImproveAttackStrength(0.25f); militaryForm.fighter.IncreaseShock(0.3f); militaryForm.fighter.ImproveDefenseStrength(0.1f); militaryForm.fighter.IncreaseAmmoConsumption(0.15f); } if (techName == "radar") { militaryForm.fighter.ImproveDefenseStrength(0.8f); militaryForm.dreadnought.ImproveAttack(0.5f); } if (techName == "bolt_action_rifles") { militaryForm.infantry.ImproveAttackStrength(0.5f); militaryForm.infantry.ImproveDefenseStrength(0.15f); militaryForm.cavalry.ImproveAttackStrength(0.25f); militaryForm.infantry.IncreaseShock(0.1f); militaryForm.cavalry.IncreaseShock(0.15f); } if (techName == "telegraph") { player.IncreaseFactoryThroughput(1); player.InceaseProductionModifier(0.15f); player.IncreaseOrgFactor(0.15f); } if (techName == "electricity") { player.IncreaseFactoryThroughput(1); player.InceaseProductionModifier(0.15f); } if (techName == "radio") { player.IncreaseOrgFactor(0.15f); } if (techName == "early_computers") { player.InceaseProductionModifier(0.15f); militaryForm.dreadnought.ImproveAttack(1); } if (techName == "atomic_bomb") { } }
private void UpdateNavyTable() { App app = UnityEngine.Object.FindObjectOfType <App>(); Nation player = State.getNations()[app.GetHumanIndex()]; MilitaryForm militaryForm = player.GetMilitaryForm(); Text frigateAttack = navyTable.Rows[1].Cells[1].GetComponentInChildren <Text>(); Debug.Log("frigate attack " + militaryForm.frigate.Attack.ToString()); frigateAttack.text = militaryForm.frigate.Attack.ToString(); Text ironcladAttack = navyTable.Rows[1].Cells[2].GetComponentInChildren <Text>(); ironcladAttack.text = militaryForm.ironclad.Attack.ToString(); Text dreadnoughtAttack = navyTable.Rows[1].Cells[3].GetComponentInChildren <Text>(); dreadnoughtAttack.text = militaryForm.dreadnought.Attack.ToString(); Text frigateMaxStrength = navyTable.Rows[2].Cells[1].GetComponentInChildren <Text>(); frigateMaxStrength.text = militaryForm.frigate.GetStrength().ToString(); Text ironcladMaxStrength = navyTable.Rows[2].Cells[2].GetComponentInChildren <Text>(); ironcladMaxStrength.text = militaryForm.ironclad.GetStrength().ToString(); Text dreadnoughtMaxStrength = navyTable.Rows[2].Cells[3].GetComponentInChildren <Text>(); dreadnoughtMaxStrength.text = militaryForm.dreadnought.GetStrength().ToString(); Text frigateMan = navyTable.Rows[3].Cells[1].GetComponentInChildren <Text>(); frigateMan.text = militaryForm.frigate.Maneuver.ToString(); Text ironcladMan = navyTable.Rows[3].Cells[2].GetComponentInChildren <Text>(); ironcladMan.text = militaryForm.ironclad.Maneuver.ToString(); Text dreadnoughtMan = navyTable.Rows[3].Cells[3].GetComponentInChildren <Text>(); dreadnoughtMan.text = militaryForm.dreadnought.Maneuver.ToString(); Text frigateAmmo = navyTable.Rows[4].Cells[1].GetComponentInChildren <Text>(); frigateAmmo.text = militaryForm.frigate.AmmoUse.ToString(); Text ironcladAmmo = navyTable.Rows[4].Cells[2].GetComponentInChildren <Text>(); ironcladAmmo.text = militaryForm.ironclad.AmmoUse.ToString(); Text dreadnoughtAmmo = navyTable.Rows[4].Cells[3].GetComponentInChildren <Text>(); dreadnoughtAmmo.text = militaryForm.dreadnought.AmmoUse.ToString(); Text frigateOil = navyTable.Rows[5].Cells[1].GetComponentInChildren <Text>(); frigateOil.text = militaryForm.frigate.OilUse.ToString(); Text ironcladOil = navyTable.Rows[5].Cells[2].GetComponentInChildren <Text>(); ironcladOil.text = militaryForm.ironclad.OilUse.ToString(); Text dreadnoughtOil = navyTable.Rows[5].Cells[3].GetComponentInChildren <Text>(); dreadnoughtOil.text = militaryForm.dreadnought.OilUse.ToString(); Text frigateCap = navyTable.Rows[6].Cells[1].GetComponentInChildren <Text>(); frigateCap.text = militaryForm.frigate.Capacity.ToString(); Text ironcladCap = navyTable.Rows[6].Cells[2].GetComponentInChildren <Text>(); ironcladCap.text = militaryForm.ironclad.Capacity.ToString(); Text dreadnoughtCap = navyTable.Rows[6].Cells[3].GetComponentInChildren <Text>(); dreadnoughtCap.text = militaryForm.dreadnought.Capacity.ToString(); Text frigateMov = navyTable.Rows[7].Cells[1].GetComponentInChildren <Text>(); frigateMov.text = militaryForm.frigate.Movement.ToString(); Text ironcladMov = navyTable.Rows[7].Cells[2].GetComponentInChildren <Text>(); ironcladMov.text = militaryForm.ironclad.Movement.ToString(); Text dreadnoughtMov = navyTable.Rows[7].Cells[3].GetComponentInChildren <Text>(); dreadnoughtMov.text = militaryForm.dreadnought.Movement.ToString(); Text NumFrig = navyTable.Rows[9].Cells[1].GetComponentInChildren <Text>(); Text NumIC = navyTable.Rows[9].Cells[2].GetComponentInChildren <Text>(); Text NumDN = navyTable.Rows[9].Cells[3].GetComponentInChildren <Text>(); float frigCount = 0; float ICCount = 0; float DNCount = 0; for (int i = 0; i < player.GetFleets().Count; i++) { frigCount += player.GetFleet(i).GetFrigate(); ICCount += player.GetFleet(i).GetIronClad(); DNCount += player.GetFleet(i).GetDreadnought(); } NumFrig.text = frigCount.ToString(); NumIC.text = ICCount.ToString(); NumDN.text = DNCount.ToString(); Text recFrig = navyTable.Rows[10].Cells[1].GetComponentInChildren <Text>(); Text recIC = navyTable.Rows[10].Cells[2].GetComponentInChildren <Text>(); Text recDN = navyTable.Rows[10].Cells[3].GetComponentInChildren <Text>(); recFrig.text = player.getNavyProducing(MyEnum.NavyUnits.frigates).ToString(); recIC.text = player.getNavyProducing(MyEnum.NavyUnits.ironclad).ToString(); recDN.text = player.getNavyProducing(MyEnum.NavyUnits.dreadnought).ToString(); Button recruitFrigateButton = navyTable.Rows[11].Cells[1].GetComponentInChildren <Button>(); if (PlayerCalculator.canBuildFrigate(player)) { recruitFrigateButton.interactable = true; } else { recruitFrigateButton.interactable = false; } Button recruitIroncladButton = navyTable.Rows[11].Cells[2].GetComponentInChildren <Button>(); if (PlayerCalculator.canBuildIronclad(player)) { recruitIroncladButton.interactable = true; } else { recruitIroncladButton.interactable = false; } Button recruitDreadnoughtButton = navyTable.Rows[11].Cells[3].GetComponentInChildren <Button>(); if (PlayerCalculator.canBuildDreadnought(player)) { recruitDreadnoughtButton.interactable = true; } else { upgradeShipyard.interactable = false; } TextMeshProUGUI _shipyardLevel = shipyardLevel.GetComponent <TextMeshProUGUI>(); _shipyardLevel.SetText("Shipyard Level: " + player.GetShipyardLevel().ToString()); if (PlayerCalculator.canUpgradeShipyard(player) == true) { upgradeShipyard.interactable = true; } else { upgradeShipyard.interactable = false; } }