Forked from SGG_SKSpineImport by mredig
See original branch for full documentation
Added three methods:
*Accepts: (NSMutableDictionary )slotsToReplace
Dictionary format:
attachment name : replacement texture
Replaces the texture of any nodes mentioned in the slotsToReplace dictionary with their accompanying textures. Creates an NSMutableDictionary in memory containing the original textures, to easily swap back. Note: be sure to use the attatchment name, not the slot name.
Created to serve my own needs: I have an avatar builder in my Sprite Kit game, and I need to swap out specific slots without changing the whole skin (so the player can choose different shirts, pants etc.).
NSDictionary* partReplacement = @{@"torso": @"goblin-torso", @"head": @"goblin-head"};
[goblin changeSkinPartial:partReplacement];
- Your dictionary's keys must match the slot names specified in the skeleton's .json file.
- If you need to replace any 'nested' nodes, you must create an entry for that slot in your dictionary.
Resets any changes made through changeSkinPartial; reverts the skeleton back to the textures used when the scene was created. Should only be called after changeSkinPartial.
*Accepts: (NSArray *)slotsToColorize withColor:(SKColor )color andIntensity:(CGFloat)blendFactor
Colorizes the slots listed in the slotsToColorize array using the specified color and blend factor. Note: be sure to use the attatchment name, not the slot name.
Can be used to make a body part flash red, or to let the player change their hair/skin color.
NSArray* partsToColorize = @[@"head", @"left-shoulder", @"torso"];
SKColor* color = [SKColor redColor];
[boy colorizeSlots:partsToColorize withColor:color andIntensity:1];
- Your array's values must match the slot names specified in the skeleton's .json file.
- If you need to colorize any 'nested' nodes, you must create an entry for that slot in your dictionary.
## Questions or comments? Let me know!