RobotGames
Member
Using the example:
/// <summary>
/// Initialize the default values.
/// </summary>
public void Awake()
{
EventHandler.RegisterEvent<float, Vector3, Vector3, GameObject, Collider>(gameObject, "OnObjectImpact", OnImpact);
}
/// <summary>
/// The object has been impacted with another object.
/// </summary>
/// <param name="amount">The amount of damage taken.</param>
/// <param name="position">The position of the damage.</param>
/// <param name="forceDirection">The direction that the object took damage from.</param>
/// <param name="attacker">The GameObject that did the damage.</param>
/// <param name="hitCollider">The Collider that was hit.</param>
private void OnImpact(float amount, Vector3 position, Vector3 forceDirection, GameObject attacker, Collider hitCollider)
{
Debug.Log(name + " impacted by " + attacker + " on collider " + hitCollider + ".");
}
The OnImpact event never fires. I have used other events and they work fine. This is in a monobehaviour that is dropped on a char, in the root along with everything else.
EDIT: It does fire it just does not get "caught" I have placed this script on the Melee Weapon and on the target.
/// <summary>
/// Initialize the default values.
/// </summary>
public void Awake()
{
EventHandler.RegisterEvent<float, Vector3, Vector3, GameObject, Collider>(gameObject, "OnObjectImpact", OnImpact);
}
/// <summary>
/// The object has been impacted with another object.
/// </summary>
/// <param name="amount">The amount of damage taken.</param>
/// <param name="position">The position of the damage.</param>
/// <param name="forceDirection">The direction that the object took damage from.</param>
/// <param name="attacker">The GameObject that did the damage.</param>
/// <param name="hitCollider">The Collider that was hit.</param>
private void OnImpact(float amount, Vector3 position, Vector3 forceDirection, GameObject attacker, Collider hitCollider)
{
Debug.Log(name + " impacted by " + attacker + " on collider " + hitCollider + ".");
}
The OnImpact event never fires. I have used other events and they work fine. This is in a monobehaviour that is dropped on a char, in the root along with everything else.
EDIT: It does fire it just does not get "caught" I have placed this script on the Melee Weapon and on the target.
Last edited: