public Action <ColorSwapAsyncOperation> CreateColorSwapTask(INitroxPlayer nitroxPlayer) { GameObject playerModel = nitroxPlayer.PlayerModel; Color playerColor = nitroxPlayer.PlayerSettings.PlayerColor; IColorSwapStrategy colorSwapStrategy = new HueSaturationVibrancySwapper(playerColor); SkinnedMeshRenderer radiationHelmetRenderer = playerModel.GetRenderer(RADIATION_HELMET_GAME_OBJECT_NAME); radiationHelmetRenderer.material.ApplyClonedTexture(); SkinnedMeshRenderer radiationSuitNeckClaspRenderer = playerModel.GetRenderer(RADIATION_SUIT_NECK_CLASP_GAME_OBJECT_NAME); radiationSuitNeckClaspRenderer.material.ApplyClonedTexture(); Color[] helmetPixels = radiationHelmetRenderer.material.GetMainTexturePixels(); Color[] neckClaspPixels = radiationSuitNeckClaspRenderer.material.GetMainTexturePixels(); return(operation => { HsvSwapper radiationHelmetFilter = new HsvSwapper(colorSwapStrategy); radiationHelmetFilter.SetSaturationRange(0f, 35f); radiationHelmetFilter.SetVibrancyRange(30f, 100f); radiationHelmetFilter.SwapColors(helmetPixels); radiationHelmetFilter.SwapColors(neckClaspPixels); operation.UpdateIndex(RADIATION_HELMET_INDEX_KEY, helmetPixels); operation.UpdateIndex(RADIATION_SUIT_NECK_CLASP_INDEX_KEY, helmetPixels); }); }
public Action <ColorSwapAsyncOperation> CreateColorSwapTask(INitroxPlayer nitroxPlayer) { GameObject playerModel = nitroxPlayer.PlayerModel; Color playerColor = nitroxPlayer.PlayerSettings.PlayerColor; HueSaturationVibrancySwapper hueSaturationVibrancySwapper = new HueSaturationVibrancySwapper(playerColor); HueSwapper hueSwapper = new HueSwapper(playerColor); SkinnedMeshRenderer radiationSuitRenderer = playerModel.GetRenderer(RADIATION_SUIT_GAME_OBJECT_NAME); radiationSuitRenderer.material.ApplyClonedTexture(); radiationSuitRenderer.materials[1].ApplyClonedTexture(); Color[] legPixelBlock = radiationSuitRenderer.material.GetMainTexturePixelBlock(legTextureBlock); Color[] feetPixelBlock = radiationSuitRenderer.material.GetMainTexturePixelBlock(feetTextureBlock); Color[] beltPixelBlock = radiationSuitRenderer.material.GetMainTexturePixelBlock(beltTextureBlock); Color[] armSleevesPixels = radiationSuitRenderer.materials[1].GetMainTexturePixels(); return(operation => { HsvSwapper radiationSuitLegFilter = new HsvSwapper(hueSaturationVibrancySwapper); radiationSuitLegFilter.SetSaturationRange(0f, 35f); radiationSuitLegFilter.SetVibrancyRange(40f, 100f); HsvSwapper radiationSuitArmAndFeetFilter = new HsvSwapper(hueSwapper); radiationSuitArmAndFeetFilter.SetHueRange(0f, 100f); radiationSuitArmAndFeetFilter.SetVibrancyRange(30f, 100f); HsvSwapper radiationSuitBeltFilter = new HsvSwapper(hueSwapper); radiationSuitBeltFilter.SetVibrancyRange(3f, 100f); radiationSuitBeltFilter.SetHueRange(0f, 90f); radiationSuitLegFilter.SwapColors(legPixelBlock); radiationSuitArmAndFeetFilter.SwapColors(feetPixelBlock); radiationSuitArmAndFeetFilter.SwapColors(armSleevesPixels); radiationSuitBeltFilter.SwapColors(beltPixelBlock); operation.UpdateIndex(RADIATION_SUIT_ARMS_INDEX_KEY, armSleevesPixels); operation.UpdateIndex(RADIATION_SUIT_LEG_INDEX_KEY, legPixelBlock); operation.UpdateIndex(RADIATION_SUIT_FEET_INDEX_KEY, feetPixelBlock); operation.UpdateIndex(RADIATION_SUIT_BELT_INDEX_KEY, beltPixelBlock); }); }
public Action <ColorSwapAsyncOperation> CreateColorSwapTask(INitroxPlayer nitroxPlayer) { GameObject playerModel = nitroxPlayer.PlayerModel; Color playerColor = nitroxPlayer.PlayerSettings.PlayerColor.ToUnity(); IColorSwapStrategy colorSwapStrategy = new HueSaturationVibrancySwapper(playerColor); SkinnedMeshRenderer radiationVestRenderer = playerModel.GetRenderer(RADIATION_SUIT_VEST_GAME_OBJECT_NAME); radiationVestRenderer.material.ApplyClonedTexture(); Color[] texturePixels = radiationVestRenderer.material.GetMainTexturePixels(); return(operation => { HsvSwapper radiationSuitVestFilter = new HsvSwapper(colorSwapStrategy); radiationSuitVestFilter.SetSaturationRange(0f, 35f); radiationSuitVestFilter.SetVibrancyRange(12f, 100f); radiationSuitVestFilter.SwapColors(texturePixels); operation.UpdateIndex(RADIATION_SUIT_VEST_INDEX_KEY, texturePixels); }); }