public void UpgradePower() { try{ if (tower) { MonekeyThroeDart monkeyThrowDart = tower.GetComponent <MonekeyThroeDart> (); if (monkeyThrowDart.BuyIncreasePower()) { } } }catch (Exception e) { } }
public void UpgradeSpeed() { try{ if (tower) { MonekeyThroeDart monkeyThrowDart = tower.GetComponent <MonekeyThroeDart> (); if (monkeyThrowDart.BuyShootFaster()) { } } } catch (Exception e) { } }
void OnCollisionEnter2D(Collision2D coll) { switch (coll.gameObject.tag) { case "Red": case "Blimp": case "Blue": EnemyHealth eHealth = coll.gameObject.GetComponent <EnemyHealth> (); MonekeyThroeDart parent = gameObject.GetComponentInParent <MonekeyThroeDart>(); for (int i = 0; i < parent.getpowerIncrease(); i++) { eHealth.gotHit(); } gameObject.GetComponentInParent <AudioSource> ().Play(); Destroy(gameObject); break; } }