I have a powerup that randomly drops from enemies. Right now I have it set up using onTriggerEnter2D
and am checking for the player
collider tag for the pickup to take effect.
public class FireRatePowerUpScript : MonoBehaviour
{
public float incrementRate = 1.3f;
private Animator anim;
private Weapon weapon;
// Use this for initialization
void Start()
{
anim = gameObject.GetComponent<Animator>();
}
// Update is called once per frame
void Update()
{
}
private void OnTriggerEnter2D(Collider2D collision)
{
if (collision.tag == "Player")
{
weapon = collision.gameObject.GetComponentInChildren<Weapon>();
weapon.fireRate *= incrementRate;
anim.SetTrigger("goPoof");
Destroy(gameObject, 1f);
}
}
}
How do I change it so that instead of the player character bumping into it I have the player click or tap on it to activate/register?
Thanks