Hi, trying to figure out why I can't get this script to work.
It's attached to the Weapon object which has the ShootableWeapon script.
What I am attempting to do is implement an overheating feature that stops the weapon from firing when overheated. I may need to modify ShootableWeapon, however, this is just my attempt at using the event system but so far no luck.
using UnityEngine;
using Opsive.Shared.Events;
public class WeaponThermalMonitor : MonoBehaviour
{
void Awake()
{
EventHandler.RegisterEvent<GameObject, bool>(gameObject, "OnShootableWeaponShowProjectile", OnFire);
}
void OnFire(GameObject projectile, bool show)
{
if(show)
Debug.Log("Fire Event");
}
}
It's attached to the Weapon object which has the ShootableWeapon script.
What I am attempting to do is implement an overheating feature that stops the weapon from firing when overheated. I may need to modify ShootableWeapon, however, this is just my attempt at using the event system but so far no luck.
using UnityEngine;
using Opsive.Shared.Events;
public class WeaponThermalMonitor : MonoBehaviour
{
void Awake()
{
EventHandler.RegisterEvent<GameObject, bool>(gameObject, "OnShootableWeaponShowProjectile", OnFire);
}
void OnFire(GameObject projectile, bool show)
{
if(show)
Debug.Log("Fire Event");
}
}