private void OnTriggerStay(Collider other) { if (other.gameObject.layer == 11) { if (Input.GetMouseButtonDown(0)) { PooledObject pooledObject = other.GetComponentInParent <PooledObject>(); TurretManager turret = other.GetComponentInParent <TurretManager>(); MineTurretScript mineTurret = other.GetComponentInParent <MineTurretScript>(); if (pooledObject != null) { foreach (Transform child in other.transform.parent.transform) { MaterialManager childMaterial = child.GetComponent <MaterialManager>(); if (childMaterial != null) { childMaterial.DefaultMaterial(); } } pooledObject.returnToPool(); if (turret != null) { money.MoneyChange(turret.value / 2); } if (mineTurret != null) { money.MoneyChange(mineTurret.value / 2); } } } } }
void Death() { isDead = true; moneyTracker.MoneyChange(moneyValue); health = startingHealth; pooledObject.returnToPool(); }
void Update() { GoToMouse(); if (Input.GetMouseButtonDown(0)) { if (canSpawn == true) { if (value <= money.dollarAmount) { //Debug.Log("pressed"); money.MoneyChange(-value); SpawnObject(); } } } }