public void spendMoney(float howMuchToSpend, SpendMoneyMethod creatingMethod) { if (money >= howMuchToSpend) { money -= howMuchToSpend; creatingMethod(); } else if (factionId == 0) { insufficientFunds.Play(); } GameMaster.GM.enemyMoneyText.text = ""; UpdateMoneyStats(); for (int i = 1; i < GameMaster.GM.shipObjectList.Count; i++) { if (GameMaster.GM.shipObjectList[i] != null) { GameMaster.GM.enemyMoneyText.text += "AI #" + i.ToString() + ": " + GameMaster.GM.shipObjectList[i].GetComponent <Ship>().money.ToString() + "\n"; } } }
public void EnemyAI() { int rndUnit; int rndBuilding; if (GameMaster.GM.aiPlayerBase == false && factionId != 0 || GameMaster.GM.aiPlayerBase == true) { { if (fractionBarracsList.Count > 0 && CountFractionWarriors(factionId) <= GameMaster.GM.unitsCount && money > 600) { //SpendMoneyMethod spendOnTrooperDelegate = startCreatingTrooper; //SpendMoneyMethod spendOnLightShipDelegate = startCreatingLightShip; rndUnit = Random.Range(0, 100); if (rndUnit < 70) { spendMoney(300, startCreatingTrooper); } } if (fractionFactoryList.Count > 0 && CountFractionWarriors(factionId) <= GameMaster.GM.unitsCount && money > 600) { //SpendMoneyMethod spendOnTrooperDelegate = startCreatingTrooper; //SpendMoneyMethod spendOnLightShipDelegate = startCreatingLightShip; rndUnit = Random.Range(0, 100); if (rndUnit < 70) { spendMoney(600, startCreatingLightShip); } } if (fractionBarracsList.Count < 3 && money > 3000) { //SpendMoneyMethod SpendOnBarracsDelegate = startBarracsConstruction; //SpendMoneyMethod SpendOnFactoryDelegate = startFactoryConstruction; rndBuilding = Random.Range(0, 100); if (rndBuilding < 50) { spendMoney(2000, startBarracsConstruction); } else { spendMoney(3000, startFactoryConstruction); } } if (fractionBarracsList.Count > 0 && money > 5000 && fractionBarracsList.Count < 3) { SpendMoneyMethod SpendOnTowerDelegate = startCreatingTower; rndBuilding = Random.Range(0, 100); spendMoney(5000, SpendOnTowerDelegate); } } } }
public void CallCreatingGunTower() { SpendMoneyMethod spendOnGunTowerDelegate = GameMaster.GM.shipObjectList[0].GetComponent <Ship>().startCreatingGunTower; GameMaster.GM.shipObjectList[0].GetComponent <Ship>().spendMoney(600, spendOnGunTowerDelegate); }
public void CallCreatingLightShip() { SpendMoneyMethod spendOnLightShipDelegate = GameMaster.GM.shipObjectList[0].GetComponent <Ship>().startCreatingLightShip; GameMaster.GM.shipObjectList[0].GetComponent <Ship>().spendMoney(600, spendOnLightShipDelegate); }
public void CallFactoryConstruction() { SpendMoneyMethod spendOnFactoryDelegate = GameMaster.GM.shipObjectList[0].GetComponent <Ship>().startFactoryConstruction; GameMaster.GM.shipObjectList[0].GetComponent <Ship>().spendMoney(3000, spendOnFactoryDelegate); }
public void CallBarracsConstruction() { SpendMoneyMethod spendOnBarracsDelegate = GameMaster.GM.shipObjectList[0].GetComponent <Ship>().startBarracsConstruction; GameMaster.GM.shipObjectList[0].GetComponent <Ship>().spendMoney(2000, spendOnBarracsDelegate); }