Files
project-reset/Assets/Scripts/Items/WeaponActor.cs
Chris 25b7fae339 feat: more combat tweaks
shuriken can now be thrown
jumping animtions
jumping animations timing
state machine changes
start of online integration
2026-01-15 14:42:33 -05:00

52 lines
1.7 KiB
C#

using System;
using System.Collections.Generic;
using NodeCanvas.Framework;
using UnityEngine;
using UnityEngine.UI;
namespace Reset.Items{
public abstract class WeaponActor : MonoBehaviour{
public Dictionary<string, Action> weaponEvents = new Dictionary<string, Action>();
public Dictionary<string, object> weaponVariables = new Dictionary<string, object>();
public Weapon relatedWeapon;
public GraphOwner relatedGraph;
public GameObject relatedObject;
// Recieve Weapon Catch signal from Animation
public void WeaponCatch(){
relatedGraph.SendEvent("Weapon Catch");
}
// Recieve Weapon Release signal from Animation
public void WeaponRelease(){
relatedGraph.SendEvent("Weapon Release");
}
public void RegisterWeaponEvent(string calledName, Action action){
weaponEvents.Add(calledName, action);
}
public void RegisterWeaponVariable(string variable, object value){
if (weaponVariables.ContainsKey(variable)) {
weaponVariables[variable] = value;
} else {
weaponVariables.Add(variable, value);
}
}
public object ReadWeaponVariable<T>(string variable) where T : class{
return (T)weaponVariables[variable];
}
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}");
}
}
}