I tried to make an event detect what weapon I used like the example below but this didn't work, how should?
Code:
private void OnObjectImpact(float amount, Vector3 position, Vector3 forceDirection, GameObject attacker, object attackerObject, Collider hitCollider)
{
Debug.Log(" impacted by " + attacker + " | " + attackerObject + " on collider " + hitCollider + ".");
if(oldhit != hitCollider.gameObject)
{
count = 0;
}
if (attackerObject == "Sword" && hitCollider.GetComponent<OpsiveBridge>().IsDeath == true && count <= maxhit)
{
if (!isRandom)
{
AddPickupToCollection(inventory.MainItemCollection);
}
else
{
AddPickupToCollection(inventory.MainItemCollection, m_MinAmount, m_MaxAmount);
}
count += 1;
}
oldhit = hitCollider.gameObject;
}