Hey,
I’m making a space shooter game and I am working on my Enemy AI. What I have decided to do is give the player 3 different weapon choices, at the moment the basic weapon is the one that is used. I have set a prefab for the basic weapon and I instantiate it when I fire.
i want to set the different weapon collisions to have different damage so I wrote this function:
void OnTriggerEnter(Collider c)
{
if(c.gameObject.name == "Basic Projectile")
{
curhealth -= PlayerPrefs.GetInt("BasicWeaponDamage");
}
}
It does not work, the basic projectile is what the prefab that is instantiated is called. I have as trigger set and have rigidbodies on both.
I can only get this script to work if I make it :
void OnTriggerEnter(Collider c)
{
curhealth -= PlayerPrefs.GetInt("BasicWeaponDamage");
}
This will not do for what I am trying to achieve, can someone please assist me, I would be most greatful. Many thanks.