Beispiel #1
0
        public static void Melee_MeleeLateUpdate(Melee __instance)
        {
            AgentHitbox hb = __instance.agent.agentHitboxScript;

            hb.heldItem2H.SetSprite(hb.heldItem2.spriteId);
            if (hb.heldItem2.CurrentSprite.__RogueLibsCustom is RogueSprite sprite)
            {
                hb.heldItem2Renderer.sharedMaterial = sprite.Material;
                hb.heldItem2H.GetComponent <Renderer>().sharedMaterial = sprite.Material;
            }

            hb.heldItemH.SetSprite(hb.heldItem.spriteId);
            if (hb.heldItem.CurrentSprite.__RogueLibsCustom is RogueSprite sprite2)
            {
                hb.heldItemRenderer.sharedMaterial = sprite2.Material;
                hb.heldItemH.GetComponent <Renderer>().sharedMaterial = sprite2.Material;
            }
        }
Beispiel #2
0
        public static bool AgentHitbox_GetColorFromString(AgentHitbox __instance, string colorChoice, string bodyPart)
        {
            AgentHitbox ah        = __instance;
            Color32     color     = Color.white;
            bool        noncustom = false;

            switch (colorChoice)
            {
            case "Clear":
                color = AgentHitbox.skinClear;
                break;

            default:
                noncustom = true;
                break;
            }
            if (colorChoice.StartsWith(":"))
            {
                color     = new Color32(0, 0, 0, 255);
                noncustom = false;
                string[] splitted = colorChoice.Substring(1).Split(new char[] { '-', '.', '|', ':', '_', ',', ';' });
                if (splitted.Length >= 1 && int.TryParse(splitted[0], out int red))
                {
                    color.r = (byte)Mathf.Clamp(red, 0, 255);
                }
                if (splitted.Length >= 2 && int.TryParse(splitted[1], out int green))
                {
                    color.g = (byte)Mathf.Clamp(green, 0, 255);
                }
                if (splitted.Length >= 3 && int.TryParse(splitted[2], out int blue))
                {
                    color.b = (byte)Mathf.Clamp(blue, 0, 255);
                }
                if (splitted.Length >= 4 && int.TryParse(splitted[3], out int aaa))
                {
                    color.a = (byte)Mathf.Clamp(aaa, 0, 255);
                }
            }
            if (noncustom)
            {
                return(true);
            }
            if (bodyPart == "Skin")
            {
                ah.skinColor = color;
            }
            else if (bodyPart == "Hair")
            {
                ah.hairColor = color;
            }
            else if (bodyPart == "Legs")
            {
                ah.legsColor = color;
            }
            else if (bodyPart == "Body")
            {
                ah.bodyColor = color;
            }
            else if (bodyPart == "Eyes")
            {
                ah.eyesColor = color;
            }
            return(false);
        }