Ejemplo n.º 1
0
        private static void KillDiagonals(On.HeroController.orig_HeroDash orig, HeroController self)
        {
            InputHandler input = ReflectionHelper.GetAttr <HeroController, InputHandler>(HeroController.instance, "inputHandler");

            if (input.inputActions.left.IsPressed || input.inputActions.right.IsPressed)
            {
                bool downEnabled = ReflectionHelper.GetAttr <OneAxisInputControl, bool>(input.inputActions.down, "Enabled");

                ReflectionHelper.SetAttr(input.inputActions.down, "Enabled", false);

                orig(self);

                ReflectionHelper.SetAttr(input.inputActions.down, "Enabled", downEnabled);
            }
            else
            {
                orig(self);
            }
        }
Ejemplo n.º 2
0
 public static void SetAttr <T>(this object obj, string name, T val, bool instance = true) =>
 ReflectionHelper.SetAttr(obj, name, val, instance);