18 lines
506 B
C#
18 lines
506 B
C#
using UnityEngine;
|
|
|
|
public class Bonus : MonoBehaviour {
|
|
|
|
//when colliding with another object, if another objct is 'Player', sending command to the 'Player'
|
|
private void OnTriggerEnter2D(Collider2D collision)
|
|
{
|
|
if (collision.tag == "Player")
|
|
{
|
|
if (PlayerShooting.instance.weaponPower < PlayerShooting.instance.maxweaponPower)
|
|
{
|
|
PlayerShooting.instance.weaponPower++;
|
|
}
|
|
Destroy(gameObject);
|
|
}
|
|
}
|
|
}
|