Cult_of_the_Shock/Hooks.cs

38 lines
1.2 KiB
C#

using HarmonyLib;
using UnityEngine;
using static Health;
namespace Cult_of_the_Shock
{
[HarmonyPatch]
public class Hooks
{
private static Shocker Shocker;
public static void OnDamage(GameObject attacker, Vector3 attackLocation, float damage, AttackTypes attackType, AttackFlags attackFlag)
{
Plugin.Logger.LogInfo($"PlayerController.Health.OnDamage: " + damage);
Shocker.Shock(Plugin.Config.GetDamageJson());
}
public static void OnDie(GameObject Attacker, Vector3 AttackLocation, Health Victim, AttackTypes AttackType, AttackFlags AttackFlags)
{
Plugin.Logger.LogInfo($"PlayerController.Health.OnDie");
Shocker.Shock(Plugin.Config.GetDeathJson());
}
public static void OnHit(GameObject Attacker, Vector3 AttackLocation, AttackTypes AttackType, bool FromBehind)
{
Plugin.Logger.LogInfo($"OnHit: " + Attacker);
}
public static void OnEnable(PlayerController __instance)
{
__instance.health.OnDamaged += OnDamage;
__instance.health.OnDie += OnDie;
Shocker = new Shocker();
Plugin.Config.Reload();
}
}
}