private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.CompareTag("Player")) { PookieController player = (PookieController)collision.gameObject.GetComponent(typeof(PookieController)); if (player != null) { Weapon sword = (Weapon)player.GetComponentInChildren <Weapon>(); if (player.getCash() >= COST) { player.removeCash(COST); player.addAttack(ATK_MOD); sword.addDamage(ATK_MOD); player.SetText(); SoundManager.instance.playSingle(SoundManager.instance.powerup); Destroy(this.gameObject); Debug.Log(sword.getDamage()); Debug.Log(player.getAtkModifier()); } } else { Debug.Log("Hm.."); } } }
/// <summary> /// Detects coin pickup from the player. /// </summary> /// <param name="collider"></param> public void OnTriggerEnter2D(Collider2D collider) { if (collider.gameObject.tag == "Player") { player = (PookieController)collider.gameObject.GetComponent(typeof(PookieController)); player.addCash(coinValue); player.SetText(); SoundManager.instance.playSingle(SoundManager.instance.pickupCoin); Destroy(gameObject); } }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.CompareTag("Player")) { PookieController player = (PookieController)collision.gameObject.GetComponent(typeof(PookieController)); BulletCtrl[] leftLasers = player.getLeftLasers(); if (player.getCash() >= COST) { player.removeCash(COST); for (int i = 0; i < leftLasers.Length; i++) { //leftLasers[i].addDamage(LASER_ATK_MOD); leftLasers[i].updateDamage(LASER_ATK_MOD); Debug.Log(leftLasers[i].getDamage() + " from " + leftLasers[i].name); } player.SetText(); Destroy(gameObject); } } }