MIF_E31221325/Assets/Sprites/Space Shooter Template FREE/Scripts/Bonus.cs

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);
}
}
}