Custom agents can be colored through the use of the Colors
property available in the CustomAgent
class. Notably, you can change the colors of individual limbs and body parts (unlike what vanilla SoR allows).
Usually, you would only define the colors only in the SetupAgent()
method:
public class MyAwesomeAgent : CustomAgent{ public override void SetupAgent() { /* ... */ Colors.Arm1Color = new Color32(105, 105, 105, 255); Colors.Arm2Color = new Color32(230, 56, 10, 255); }}
Instead of turning off or destroying sprites that you don't need, set their transparency (alpha channel) to 0 instead. It's more reliable, as vanilla code is hard-coded to re-enable them constantly.
public class MyAwesomeAgent : CustomAgent{ public override void SetupAgent() { /* ... */ Colors.EyesColor = new Color32(0, 0, 0, 0); Colors.HairColor = new Color32(0, 0, 0, 0); }}
Property name | Description |
---|---|
HairColor | The color of the agent's hair. Overrides AgentHitbox.hairColor . |
FacialHairColor | The color of the agent's facial hair. Overrides AgentHitbox.facialHairColor . |
HeadColor | The color of the agent's head. Overrides AgentHitbox.skinColor . |
EyesColor | The color of the agent's eyes. Overrides AgentHitbox.eyesColor . |
BodyColor | The color of the agent's body. Overrides AgentHitbox.bodyColor . |
Arm1Color | The color of the agent's arm1. Overrides AgentHitbox.skinColor . |
Arm2Color | The color of the agent's arm2. Overrides AgentHitbox.skinColor . |
Leg1Color | The color of the agent's leg1. Overrides AgentHitbox.legsColor . |
Leg2Color | The color of the agent's leg2. Overrides AgentHitbox.legsColor . |
FootwearColor | The color of the agent's footwear. Overrides AgentHitbox.footwearColor . |
Do not use original color fields, like AgentHitbox.hairColor
, AgentHitbox.skinColor
and etc. They're not gonna work on custom agents, since RogueLibs uses the colors from AgentColors
instead.