Hey, I am trying to get an object to send a message up to the “hit” object, but it’s not quite working the way I want it to. Anybody know why, or how to make it work/a different method to do this? Thank you in advance!
This is attached to the player:
void OnTriggerEnter (Collider hit)
{
if(hit.gameObject.tag == "Weapon")
{
if(Inventory.Instance.HCisUnlocked == false)
{
Inventory.Instance.HCisUnlocked = true;
//Turn off the Collider
hit.collider.SendMessageUpwards("CollectionNotifier", CollectionNotifier, SendMessageOptions.DontRequireReceiver);
Debug.Log("Collected PowerUp");
}
if(Inventory.Instance.HCisUnlocked == true)
{
WeaponStates.Instance.HC.Ammo += AmmoBoost;
hit.collider.SendMessageUpwards("CollectionNotifier", CollectionNotifier, SendMessageOptions.DontRequireReceiver);
}
}
}
This is attached to the power up to turn it off (if CollectCheck is bigger than 1 it is disabled):
public void CollectionNotifier (float CollectionNotifier)
{
CollectCheck += CollectionNotifier;
Debug.Log ("John has stepped into the Fire");
}