// Update is called once per frame public void OnTriggerEnter2D(Collider2D other) { if (other.CompareTag("Player")) { Debug.Log("player found"); if (goldReference.currentGold >= price && !weaponReference.accuracyUpgraded[weaponReference.currentWeapon]) { goldReference.EditGold(-price); weaponReference.upgradeAccuracy(weaponToUpgrade); gameObject.GetComponentInChildren <TextMesh>().text = "Sold Out"; } } }
// Update is called once per frame public void OnTriggerEnter2D(Collider2D other) { if (other.CompareTag("Player")) { Debug.Log("player found"); if (goldReference.currentGold >= pricePerLevel * shopLevel) { goldReference.EditGold(-pricePerLevel * shopLevel); weaponReference.upgradeWeaponDamage(weaponToUpgrade); shopLevel++; gameObject.GetComponentInChildren <TextMesh>().text = (pricePerLevel * shopLevel).ToString(); } } }
// Update is called once per frame public void OnTriggerEnter2D(Collider2D other) { if (other.CompareTag("Player")) { Debug.Log("player found"); if (goldReference.currentGold >= price && !bombUpgraded) { goldReference.EditGold(-price); bomb.upgradeBombCooldown(); bombUpgraded = true; gameObject.GetComponentInChildren <TextMesh>().text = "Sold Out"; //gameObject.GetComponentInChildren<TextMesh>().text = (pricePerLevel * shopLevel).ToString(); } } }
// Update is called once per frame void Update() { //changeHealth(20 * Time.deltaTime); if (health <= 0) { //reference the corpse to see what the zombie is if (corpse.name == "FastCorpse") { WaveManager.KillFast(); } else if (corpse.name == "MongoCorpse") { WaveManager.KillMongo(); } else if (corpse.name == "WumboCorpse") { WaveManager.KillWumbo(); } else { WaveManager.KillZombie(); } int.TryParse(score.text, out goldTemp); int addedGold = Random.Range(5, 15); goldTemp += addedGold; goldRefrence.EditGold(addedGold); //totalGold += Random.Range(1, 6); Debug.Log("New gold total: " + goldTemp); score.text = goldTemp.ToString(); Instantiate(corpse, transform.position, spriteRef.transform.rotation); Destroy(gameObject); } if (this.transform.position != target.position) { float step = speed * Time.deltaTime; this.transform.position = Vector3.MoveTowards(this.transform.position, target.position, step); } }