Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- internal static class ManagedHook
- {
- private const BindingFlags AllFlags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static |
- BindingFlags.Instance | BindingFlags.DeclaredOnly;
- internal delegate void d_UpdatePhysicsLogic(Boy boy);
- internal static d_UpdatePhysicsLogic origUpdatePhysicsLogic;
- internal static Hook OnUpdatePhysicsLogic;
- internal static void Init()
- {
- try
- {
- var fr = typeof(BoyRunState).GetMethod("UpdatePhysicsLogic", AllFlags);
- var to = typeof(ManagedHook).GetMethod("HookUpdatePhysicsLogic", AllFlags);
- OnUpdatePhysicsLogic = new Hook(typeof(BoyRunState).GetMethod("UpdatePhysicsLogic", AllFlags),
- typeof(ManagedHook).GetMethod("HookUpdatePhysicsLogic", AllFlags));
- origUpdatePhysicsLogic = OnUpdatePhysicsLogic.GenerateTrampoline<d_UpdatePhysicsLogic>();
- }
- catch (Exception e)
- {
- Logger.Logger.Log(e.ToString(), LogLevel.Error);
- }
- }
- private static void HookUpdatePhysicsLogic(Boy boy)
- {
- origUpdatePhysicsLogic(boy);
- /*if (boy.state is BoyRunState boyRunState)
- {
- boyRunState.UpdateImpulses();
- BoyRunState.UpdatePhysicsAndCrawling(boy, vector2f.zero);
- //Logger.Logger.Log("a", LogLevel.Error);
- //boy.gameObject.transform.SetLocalPositionRotation(boy.gameObject.transform.localPosition + new Vector3(1000, 0, 0), Quaternion.identity);
- if (Input.GetKeyDown(KeyCode.RightArrow))
- {
- }
- }*/
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement