private void Destruct() { if (this.gameObject.tag == "Tower") { transform.parent.GetComponent <PlacementController>().TowerDestroyed(); } if (this.gameObject.tag == "Enemy") { int enemyValue = transform.GetComponent <Enemy>().enemyCashValue; resourceManager.AddCash(enemyValue); } Destroy(this.gameObject); GameObject expl = (GameObject)Instantiate(explosion, transform.position, transform.rotation); Destroy(expl, 1); }
/// <summary> /// This method adds the specified amount of Cash to the players inventory. /// </summary> /// <param name="toAdd"></param> public void AddResources(float toAdd) { resourceManager.AddCash((int)toAdd); }