void BuildTurret(TurretBlueprint blueprint) { if (PlayerStats.Money < blueprint.cost[UpgradeID]) { Debug.Log("Insuficient Funds"); return; } PlayerStats.Money -= blueprint.cost[0]; GameObject _turret = (GameObject)Instantiate(blueprint.prefab[0], GetBuildPos(), Quaternion.identity); turret = _turret; turretBlueprint = blueprint; GameObject BuildFx = Instantiate(buildManager.BuildFX, GetBuildPos(), Quaternion.identity); Destroy(BuildFx, 5f); Debug.Log("Turret Built. Money left: " + PlayerStats.Money); }
void buildTurret(TurretBlueprint bluePrint) { if (PlayerStats.money < bluePrint.cost) { Debug.Log("not enough money"); return; } AudioManager.instance.playSound(buildSfx); PlayerStats.money -= bluePrint.cost; GameObject turretAlt = (GameObject)Instantiate(bluePrint.prefab, getBuildPosition(), Quaternion.identity); turret = turretAlt; turretBlueprint = bluePrint; GameObject effect = (GameObject)Instantiate(buildManager.buildEffect, getBuildPosition(), Quaternion.identity); Destroy(effect, 5f); }
void BuildTurret(TurretBlueprint blueprint) { if (PlayerStats.Money < blueprint.cost) { Debug.Log("Not enough money!"); return; } PlayerStats.Money -= blueprint.cost; GameObject _turret = Instantiate(blueprint.prefab, GetBuildPosition(), Quaternion.identity); turret = _turret; turretBlueprint = blueprint; GameObject effect = (GameObject)Instantiate(buildManager.buildEffect, GetBuildPosition(), Quaternion.identity); Destroy(effect, 5f); Debug.Log("Turret Build!"); }
void BuildTurret(TurretBlueprint blueprint) { if (PLayerStats.Money < blueprint.cost) { Debug.Log("Not Enough Money"); return; } PLayerStats.Money -= blueprint.cost; GameObject _turret = (GameObject)Instantiate(blueprint.prefab, GetBuildPosition(), Quaternion.identity); turret = _turret; turretBlueprint = blueprint; Debug.Log("Turret upgraded!"); }
void BuildTurret(TurretBlueprint blueprint) { if (PlayerStats.money < blueprint.cost) { return; } PlayerStats.money -= blueprint.cost; nodeEvent.clip = builsSFX; nodeEvent.Play(); GameObject _turret = (GameObject)Instantiate(blueprint.prefabTurret, GetBuildPosition(), Quaternion.identity); turret = _turret; turretBlueprint = blueprint; GameObject effect = (GameObject)Instantiate(buildManager.buidEffect, GetBuildPosition(), Quaternion.identity); Destroy(effect, 5f); blueprint.cost += blueprint.cost; }
void BuildTurret(TurretBlueprint blueprint) { if (PlayerStats.Money < blueprint.cost) { Debug.Log("Not enough money to build that!"); AudioManager.instance.Play("negate"); return; } PlayerStats.Money -= blueprint.cost; turret = Instantiate(blueprint.prefab, GetBuildPosition(), Quaternion.identity); turret.transform.SetParent(transform); turret.SetActive(false); turret.SetActive(true); turret.name = blueprint.name; buildManager.DeselectTurret(); if (turret.GetComponent <TowerBase>()) { towerBuilded = turret.GetComponent <TowerBase>(); } else { towerBuilded = turret.GetComponentInChildren <TowerBase>(); } turretBlueprint = blueprint; //GameObject effect = Instantiate(buildManager.buildEffect, GetBuildPosition(), Quaternion.identity); //Destroy(effect, 5f); StartCoroutine(Effect.PlayEffect(buildEffect, transform)); towerBuilded.upgrades = new Dictionary <string, int>(UpgradeHandler.data.towerUpgrades[blueprint.name]); Dictionary <string, int> backup = new Dictionary <string, int>(towerBuilded.upgrades); foreach (string item in backup.Keys) { towerBuilded.upgrades[item] = 0; } //Sound AudioManager.instance.Play("buildTurret"); Debug.Log("Turret built!"); PlayerStats.UpdateMoney(); }
public void SellTurret() { if (!isUpgraded) { PlayerStats.money += turretBlueprint.GetSellAmount(); } else { PlayerStats.money += turretBlueprint.GetSellAmountIsUpgraded(); isUpgraded = false; } Destroy(turret); turretBlueprint = null; GameObject temp = Instantiate(BuildManager.instance.sellEffect, GetBuildPosition(), Quaternion.identity); Destroy(temp, 4f); }
private void BuildTurret(TurretBlueprint blueprint) { if (PlayerStats.money < blueprint.cost) { return; } PlayerStats.money -= blueprint.cost; GameObject temp = Instantiate(blueprint.prefab, GetBuildPosition(), Quaternion.identity); turret = temp; temp = Instantiate(BuildManager.instance.buildEffect, GetBuildPosition(), Quaternion.identity); Destroy(temp, 4f); turretBlueprint = BuildManager.instance.TurretToBuild; meshRend.material.color = Color.red; }
void BuildTurret(TurretBlueprint blueprint) { // if (blueprint.prefab != null) // { var achievement = AchievmentThingy.GetComponent <MB_AchievementObserver>(); // Initializes the achievment observer... if (blueprint == null) { return; } if (NS_GameManager.Money < blueprint.cost) { a_Audio.clip = error; a_Audio.PlayOneShot(error); Debug.Log("Not enough money"); return; } NS_GameManager.Money -= blueprint.cost; NS_GameManager.MoneyChanged(); //matthews function addition for money UI GameObject _turret = (GameObject)Instantiate(blueprint.prefab, GetBuildPosition(), Quaternion.identity); turret = _turret; turretHealth = turret.GetComponent <NS_Turret>().health; // _turret.GetComponent<NS_Turret>().startHealth; turretBlueprint = blueprint; achievement.TurretAchievementNum++; if (achievement.HasUnlockedTurretAchivement == false) { achievement.CheckAchievements(); // Checks achievement progress... } a_Audio.clip = turretplaced; a_Audio.PlayOneShot(turretplaced); Debug.Log("turret built"); // } }
public void BuildTurret() { var turretToBuild = BuildManager.instance.turretToBuild; if (PlayerStats.instance.money < turretToBuild.cost) { Debug.Log("Not enough money"); return; } turret = Instantiate(turretToBuild.prefab, GetBuildPosition(), Quaternion.identity); var buildEffect = Instantiate(buildManager.buildEffectPrefab, GetBuildPosition(), Quaternion.identity); turretBlueprint = turretToBuild; Destroy(buildEffect, 5f); PlayerStats.instance.SetMoney((currentMoney) => currentMoney - turretToBuild.cost); }
public void BuildTurretOn(Node node) { if (PlayerStats.Money < turretToBuild.price) { Debug.Log("Not enough money."); return; } PlayerStats.Money -= turretToBuild.price; Debug.Log("Turret build. Money = $" + PlayerStats.Money.ToString()); GameObject turret = (GameObject)Instantiate(turretToBuild.prefab, node.transform.position + turretToBuild.offSet, Quaternion.identity); node.turret = turret; CanBuild = false; turretToBuild = null; shop.turretPurchased = false; shop.ClearInfo(); }
void BuildTurret(TurretBlueprint blueprint) { if (PlayerStat.money < blueprint.cost) { Debug.Log("Not enough money to build"); return; } else { PlayerStat.money -= blueprint.cost; GameObject _turret = (GameObject)Instantiate(blueprint.prefab, GetBuildPosition(), Quaternion.identity); turret = _turret; turretBlueprint = blueprint; GameObject effect = (GameObject)Instantiate(blueprint.effect, GetBuildPosition(), Quaternion.identity); Destroy(effect, 5f); Debug.Log("Turrent build! Money left " + PlayerStat.money); } }
public void SelectNode(Node node) { if (EventSystem.current.IsPointerOverGameObject()) { return; } Debug.Log("Select Node"); if (selectedNode == node) { DeselectNode(); return; } turretToBuild = null; selectedNode = node; nodeUI.SetTarget(node); }
private void RPC_BuildTurret(TurretBlueprint blueprint) { if (PlayerStats.Money < blueprint.cost) { Debug.Log("Not enough gold!"); return; } PlayerStats.Money -= blueprint.cost; GameObject _turret = PhotonNetwork.Instantiate(blueprint.prefabs.name, GetBuildPosition(), Quaternion.identity, 0) as GameObject; //GameObject _turret = (GameObject)Instantiate (blueprint.prefabs, GetBuildPosition (), Quaternion.identity); turret = _turret; turretBlueprint = blueprint; Debug.Log(PlayerStats.Money); }
void BuildTurret(TurretBlueprint turretBlueprint) { if (PlayerStats.Money < turretBlueprint.cost) { Debug.Log("Not enough money to build the turret"); return; } GameObject turret = (GameObject)Instantiate(turretBlueprint.prefab, this.GetBuildPsotion(), Quaternion.identity); GameObject buildEffect = (GameObject)Instantiate(buildManager.buildEffect, this.GetBuildPsotion(), Quaternion.identity); Destroy(buildEffect, 3f); this.turret = turret; this.turretBlueprint = turretBlueprint; PlayerStats.Money -= turretBlueprint.cost; Debug.Log("Turret to build"); }
public void SelectNode(Node node) { if (selectedNode == node) { DeselectNode(); return; } //if (node.buildingDisable) //{ // nodeUI.SetTarget(node); // return; //} selectedNode = node; turretToBuild = null; nodeUI.SetTarget(node); }
public void SellTurret() { if (isUpgraded) { PlayerStats.Money += turretBlueprint.GetSellAmountOfUpgrade(); } else { PlayerStats.Money += turretBlueprint.GetSellAmount(); } GameObject effect = (GameObject)Instantiate(buildManager.sellEffect, GetBuildPosition(), Quaternion.identity); Destroy(effect, 5f); isUpgraded = false; Destroy(turret); turretBlueprint = null; }
// Remove a turret from the selected turrets list by clicking it public void RemoveTurret(int turretIndex) { // If you click an empty slot if (turretIndex >= selectedTurrets.Count) { return; } TurretBlueprint turret = SelectedTurrets.instance.selectedTurrets[turretIndex]; //if (!selectedTurrets.Contains(turret)) return; //Transform element = selectedTurretsGUI.transform.GetChild(turretIndex); //element.GetComponent<Image>().color = new Color(0, 0, 0, 0); //element.GetComponentInChildren<Text>().text = "$0"; SelectedTurrets.instance.selectedTurrets.Remove(turret); selectedTurrets.Remove(turret.name); UpdateSelectedTurrets(); }
public void SellTurret() { PlayerStats.Money += turretBlueprint.GetSellAmount(); // TODO do better sound GameObject soundGameObject = new GameObject(); soundGameObject.transform.position = turret.transform.position; AudioSource audioSource = soundGameObject.AddComponent <AudioSource>(); audioSource.clip = Resources.Load("Sound/Cha Ching") as AudioClip; audioSource.Play(); Destroy(soundGameObject, 5f); Destroy(turret); turret = null; turretBlueprint = null; isUpgraded = false; }
void BuildTurret(TurretBlueprint blueprint) { if (StatsManager.Money < blueprint.cost) { return; } StatsManager.Money -= blueprint.cost; GameObject _turret = (GameObject)Instantiate(blueprint.prefab, GetBuildPosition(), Quaternion.identity); turret = _turret; turretBlueprint = blueprint; GameObject effect = (GameObject)Instantiate(BuildManager.instance.buildEffect, GetBuildPosition(), Quaternion.identity); Destroy(effect, 5f); Debug.Log("Turret built!"); }
public void SellTurret() { // Refund Player some Money PlayerStats.Money += turretBlueprint.GetSellAmount(); // Stop Repeating Function checking turrets health CancelInvoke(nameof(CheckForDamage)); //Spawn Effect GameObject effect = Instantiate(buildManager.sellEffect, GetBuildPosition(), Quaternion.identity); Destroy(effect, 5f); Destroy(turret); turretBlueprint = null; isDamaged = false; isDestroyed = false; }
// selecting a node public void SelectNode(Node node) { // deselect the node if it is already selected if (selectedNode == node) { DeselectNode(); return; } // bring up turret menu (upgrade/sell) selectedNode = node; turretToBuild = null; turretPanel.SetActive(false); misslePanel.SetActive(false); laserPanel.SetActive(false); nodeUI.SetTarget(node); }
public void HighlightNodes(TurretBlueprint passedTurret) { if ((turretToBuild != null && turretToBuild.Equals(passedTurret)) || (passedTurret == null)) { UnSelectTurret(); foreach (Node node in nodes) { node.GetComponent <Renderer>().material.color = node.notEnoughMoneyColor; } } else { SelectTurretToBuild(passedTurret); foreach (Node node in nodes) { node.GetComponent <Renderer>().material.color = node.TurretPositionColor; } } }
public void SellTurret() { if (m_isTurretUpgraded) { PlayerStats.m_Money += m_Blueprint.m_SellValue + m_Blueprint.GetSellUpgrade(); } else { PlayerStats.m_Money += m_Blueprint.m_SellValue; } GameObject effect = (GameObject)Instantiate(BuildManager.m_ThisInstance.m_SoldEffect, GetBuildPosition(), Quaternion.identity); Destroy(effect, 3f); Destroy(m_Turret); m_Blueprint = null; m_isTurretUpgraded = false; }
void BuildTurret(TurretBlueprint blueprint) { if (PlayerStats.Money < blueprint.cost) { Debug.Log("NOT ENOUGH MONEY"); return; } PlayerStats.Money -= blueprint.cost; GameObject _turret = Instantiate(blueprint.prefab, getBuildPosition(), Quaternion.identity); turret = _turret; turretBluePrint = blueprint; GameObject effect = (GameObject)Instantiate(buildManager.buildTurretEffect, getBuildPosition(), Quaternion.identity); Destroy(effect, 1.0f); }
public void SelectNode(Node node) { if (selectedNode == node) { node.UnHighlight(); DeselectNode(); return; } if (selectedNode != null) { selectedNode.UnHighlight(); } node.Highlight(); selectedNode = node; turretToBuild = null; nodeUI.SetTarget(node); }
void BuildTurret(TurretBlueprint blueprint) { if (PlayerStatistics.Money < blueprint.cost) { Debug.Log("Need more vespian gas."); return; } PlayerStatistics.Money -= blueprint.cost; GameObject _turret = Instantiate(blueprint.prefab, GetBuildPosition(), Quaternion.identity); turret = _turret; turretBlueprint = blueprint; GameObject effect = Instantiate(buildMan.buildEffect, GetBuildPosition(), Quaternion.identity); Destroy(effect, 5f); }
private void BuildTurret(TurretBlueprint blueprint) { if (!BuildManager.instance.HasMoney) { Debug.Log("Not enough money!"); return; // TODO display not enough money } PlayerStats.money -= blueprint.cost; GameObject _turret = Instantiate(blueprint.prefab, transform.position + new Vector3(0f, 0.5f, 0f), Quaternion.identity) as GameObject; turret = _turret; turretBlueprint = blueprint; GameObject effect = Instantiate(BuildManager.instance.buildEffect, transform.position + new Vector3(0f, 0.5f, 0f), Quaternion.identity) as GameObject; Destroy(effect, 3f); }
void BuildTurret(TurretBlueprint blueprint) { if (PlayerStats.Money < blueprint.cost) { Debug.Log("Uang ga cukup bos"); return; } PlayerStats.Money = PlayerStats.Money - blueprint.cost; GameObject _turret = (GameObject)Instantiate(blueprint.prefab, GetBuildPosition(), Quaternion.identity); turret = _turret; GameObject effect = (GameObject)Instantiate(buildManager.buildEffect, GetBuildPosition(), Quaternion.identity); Destroy(effect, 5f); Debug.Log("Turret dibeli! " + blueprint.cost + " , Sisa Uang:" + PlayerStats.Money); }
void BuildTurret(TurretBlueprint blueprint) { if (PlayerStats.Money < blueprint.cost) { Debug.Log("Not enough money to build that turret."); return; } PlayerStats.Money -= blueprint.cost; GameObject t = Instantiate(blueprint.prefab, GetBuildPosition(), Quaternion.identity); turret = t; turretBlueprint = blueprint; GameObject fx = Instantiate(buildManager.buildEffect, GetBuildPosition(), Quaternion.identity); Destroy(fx, 5f); Debug.Log("Turret built."); }
public void SelectTurretToBuild(TurretBlueprint turret) { turretToBuild = turret; }