private static void EnemyDeathEffects_EmitSound(On.EnemyDeathEffects.orig_EmitSound orig, EnemyDeathEffects self) { if (self is EnemyDeathEffectsProxy) { var proxy = (EnemyDeathEffectsProxy)self; self.GetComponent <IDeathEffects>().EmitSounds(); } else { orig(self); } }
private static void EnemyDeathEffects_RecieveDeathEvent(On.EnemyDeathEffects.orig_RecieveDeathEvent orig, EnemyDeathEffects self, float?attackDirection, bool resetDeathEvent, bool spellBurn, bool isWatery) { if (self is EnemyDeathEffectsProxy) { var proxy = (EnemyDeathEffectsProxy)self; if (DeathEventFunc == null) { var deathEventMethod = typeof(ModHooks).GetMethod("OnRecieveDeathEvent", BindingFlags.Instance | BindingFlags.NonPublic); DeathEventFunc = (RecieveDeathDelegate)Delegate.CreateDelegate(typeof(RecieveDeathDelegate), deathEventMethod); DidFireField = typeof(EnemyDeathEffects).GetField("didFire", BindingFlags.Instance | BindingFlags.NonPublic); } DeathEventFunc.Invoke(null, self, (bool)DidFireField.GetValue(self), ref attackDirection, ref resetDeathEvent, ref spellBurn, ref isWatery); self.GetComponent <IDeathEffects>().PlayDeathEffects(proxy.health.LastAttackInfo); //DeathEventFunc.Invoke(ModHooks.Instance, new object[] { self, DidFireField.GetValue(self), }); } else { orig(self, attackDirection, resetDeathEvent, spellBurn, isWatery); } }