private void LoadDefensiveObjectsStatus() { DefensiveSpikes spikesObject = DefensiveObjectsArray[0].prefabs.GetComponent <DefensiveSpikes>(); //KOLCE DefensiveObject baricadeObject = DefensiveObjectsArray[1].prefabs.GetComponent <DefensiveObject>(); //PŁOT if (!SaveSystem.isGameLoaded) { spikesObject.Initialize(); baricadeObject.Initialize(); } //BARRICADE UI.S.baricadeUpgrade.text = "Endurance: " + baricadeObject.maxHP + " -> " + (baricadeObject.maxHP + baricadeObject.bonusHealtOnLevel); UI.S.baricadeCost.text = "Upgrade: " + baricadeObject.upgradePrice + "$"; if (baricadeObject.currentLevel == baricadeObject.maxLevel) { UI.S.baricadeUpgrade.text = "Endurance: " + baricadeObject.maxHP; UI.S.baricadeCost.text = "MAX LEVEL REACHED"; } //SPIKES UI.S.spikeUpgrade.text = "Damage: " + spikesObject.damageEnemy + " -> " + (spikesObject.damageEnemy + spikesObject.damageUpgrade) + "\n" + "Endurance: " + spikesObject.health + " -> " + (spikesObject.health + spikesObject.healthUpgrade); UI.S.spikeCost.text = "Upgrade: " + spikesObject.upgradePrice + "$"; if (spikesObject.currentLevel == spikesObject.maxLevel) { UI.S.spikeUpgrade.text = "Damage: " + spikesObject.damageEnemy + "\n" + "Endurance: " + spikesObject.health; UI.S.spikeCost.text = "MAX LEVEL REACHED"; } }
public void BuyStealFency() { Debug.Log("Kupuję kubuje płot stalowy"); DefensiveObject baricadeObject = DefensiveObjectsArray[1].prefabs.GetComponent <DefensiveObject>(); if (baricadeObject.Upgrade()) { audioSourceBuing.Play(); UI.S.baricadeUpgrade.text = "Endurance: " + baricadeObject.maxHP + " -> " + (baricadeObject.maxHP + baricadeObject.bonusHealtOnLevel); UI.S.baricadeCost.text = "Upgrade: " + baricadeObject.upgradePrice + "$"; } if (baricadeObject.currentLevel == baricadeObject.maxLevel) { UI.S.baricadeUpgrade.text = "Endurance: " + baricadeObject.maxHP; UI.S.baricadeCost.text = "MAX LEVEL REACHED"; } }
private void UpdateButtonsStatus() { foreach (GameObject gameObject in shopPanelsArray) { Image image = gameObject.GetComponent <Image>(); if (gameObject.name == "BuyAmmo") { if (Main.S.gold >= rifleAmmoPrice && weapon.GetWeapon().GetType() != Weapon.WeaponType.ePistol) { image.color = greenToBuy; } else { image.color = redToBuy; } } else if (gameObject.name == "BuyHealth") { if (Main.S.gold >= Player.S.GetHpUpgradeCost()) { image.color = greenToBuy; } else { image.color = redToBuy; } if (Player.S.GetMaxHpLevel() == Player.S.GetHpLevel()) { image.color = yellowToBuy; } } else if (gameObject.name == "BuyGun") { Weapon.Pistol pistol = (Weapon.Pistol)weapon.weapons.Find(w => w.GetType() == Weapon.WeaponType.ePistol); if (Main.S.gold >= pistol.GetMoneyForUpgrade()) { image.color = greenToBuy; } else { image.color = redToBuy; } if (pistol.GetMaxLevel() == pistol.GetLevel()) { image.color = yellowToBuy; } } else if (gameObject.name == "BuySemiAutomaticGun") { Weapon.SemiAutomatic semi = (Weapon.SemiAutomatic)weapon.weapons.Find(w => w.GetType() == Weapon.WeaponType.eSemiAutomatic); if (semi == null) { semi = new Weapon.SemiAutomatic(); if (Main.S.gold >= semi.GetBuyingPrice()) { image.color = greenToBuy; } else { image.color = redToBuy; } } else { if (Main.S.gold >= semi.GetMoneyForUpgrade()) { image.color = greenToBuy; } else { image.color = redToBuy; } } if (semi.GetMaxLevel() == semi.GetLevel()) { image.color = yellowToBuy; } } else if (gameObject.name == "BuyAutomaticGun") { Weapon.Automatic auto = (Weapon.Automatic)weapon.weapons.Find(w => w.GetType() == Weapon.WeaponType.eAutomatic); if (auto == null) { auto = new Weapon.Automatic(); if (Main.S.gold >= auto.GetBuyingPrice()) { image.color = greenToBuy; } else { image.color = redToBuy; } } else { if (Main.S.gold >= auto.GetMoneyForUpgrade()) { image.color = greenToBuy; } else { image.color = redToBuy; } } if (auto.GetMaxLevel() == auto.GetLevel()) { image.color = yellowToBuy; } } else if (gameObject.name == "BuyFencyUpgrade") { DefensiveObject baricadeObject = DefensiveObjectsArray[1].prefabs.GetComponent <DefensiveObject>(); //PŁOT if (Main.S.gold >= baricadeObject.upgradePrice) { image.color = greenToBuy; } else { image.color = redToBuy; } if (baricadeObject.maxLevel == baricadeObject.currentLevel) { image.color = yellowToBuy; } } else if (gameObject.name == "BuySpikeUpgrade") { DefensiveSpikes spikesObject = DefensiveObjectsArray[0].prefabs.GetComponent <DefensiveSpikes>(); //KOLCE if (Main.S.gold >= spikesObject.upgradePrice) { image.color = greenToBuy; } else { image.color = redToBuy; } if (spikesObject.maxLevel == spikesObject.currentLevel) { image.color = yellowToBuy; } } else if (gameObject.name == "BuySniperRifle") { Weapon.SniperRifle rifle = (Weapon.SniperRifle)weapon.weapons.Find(w => w.GetType() == Weapon.WeaponType.eSniperRifle); if (rifle == null) { rifle = new Weapon.SniperRifle(); if (Main.S.gold >= rifle.GetBuyingPrice()) { image.color = greenToBuy; } else { image.color = redToBuy; } } else { if (Main.S.gold >= rifle.GetMoneyForUpgrade()) { image.color = greenToBuy; } else { image.color = redToBuy; } } if (rifle.GetMaxLevel() == rifle.GetLevel()) { image.color = yellowToBuy; } } } }