Ejemplo n.º 1
0
            private static void Postfix(PlayerPhysics __instance)
            {
                AnimationClip currentAnimation = __instance.Animator.GetCurrentAnimation();

                if (currentAnimation == __instance.CurrentAnimationGroup.ClimbAnim || currentAnimation == __instance.CurrentAnimationGroup.ClimbDownAnim)
                {
                    return;
                }
                HatParent hp = __instance.myPlayer.HatRenderer;

                if (hp.Hat == null)
                {
                    return;
                }
                HatExtension extend = hp.Hat.getHatExtension();

                if (extend == null)
                {
                    return;
                }
                if (extend.FlipImage != null)
                {
                    if (__instance.rend.flipX)
                    {
                        hp.FrontLayer.sprite = extend.FlipImage;
                    }
                    else
                    {
                        hp.FrontLayer.sprite = hp.Hat.hatViewData.viewData.MainImage;
                    }
                }
                if (extend.BackFlipImage != null)
                {
                    if (__instance.rend.flipX)
                    {
                        hp.BackLayer.sprite = extend.BackFlipImage;
                    }
                    else
                    {
                        hp.BackLayer.sprite = hp.Hat.hatViewData.viewData.BackImage;
                    }
                }
            }
Ejemplo n.º 2
0
 static void Postfix(HatParent __instance, [HarmonyArgument(0)] uint hatId, [HarmonyArgument(1)] int color)
 {
     if (DestroyableSingleton <TutorialManager> .InstanceExists)
     {
         try {
             string           filePath  = Path.GetDirectoryName(Application.dataPath) + @"\TheOtherHats\Test";
             DirectoryInfo    d         = new DirectoryInfo(filePath);
             string[]         filePaths = d.GetFiles("*.png").Select(x => x.FullName).ToArray(); // Getting Text files
             List <CustomHat> hats      = createCustomHatDetails(filePaths, true);
             if (hats.Count > 0)
             {
                 __instance.Hat = CreateHatBehaviour(hats[0], true, true);
                 __instance.SetHat(color);
             }
         } catch (System.Exception e) {
             System.Console.WriteLine("Unable to create test hat\n" + e);
         }
     }
 }