Beispiel #1
0
 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..");
         }
     }
 }
Beispiel #2
0
 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);
         }
     }
 }