feat: add test shurken
This commit is contained in:
26
Assets/Scripts/Items/WeaponActor.cs
Normal file
26
Assets/Scripts/Items/WeaponActor.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
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}");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user