26 lines
798 B
C#
26 lines
798 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace Reset.Items{
|
|
public abstract class WeaponActor : MonoBehaviour{
|
|
public Dictionary<string, Action> weaponEvents = new Dictionary<string, Action>();
|
|
|
|
public Weapon relatedWeapon;
|
|
public GameObject relatedObject;
|
|
|
|
public void RegisterWeaponEvent(string calledName, Action action){
|
|
weaponEvents.Add(calledName, action);
|
|
}
|
|
|
|
public void DoWeaponEvent(string eventName){
|
|
if (weaponEvents.ContainsKey(eventName)) {
|
|
weaponEvents[eventName].Invoke();
|
|
|
|
return;
|
|
}
|
|
|
|
Debug.LogError($"There is no event by name of {eventName} in {name}");
|
|
}
|
|
}
|
|
} |