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; IColorSwapStrategy colorSwapStrategy = new HueSwapper(playerColor); SkinnedMeshRenderer reinforcedSuitRenderer = playerModel.GetRenderer(REINFORCED_SUIT_GAME_OBJECT_NAME); reinforcedSuitRenderer.material.ApplyClonedTexture(); reinforcedSuitRenderer.materials[1].ApplyClonedTexture(); SkinnedMeshRenderer reinforcedGloveRenderer = playerModel.GetRenderer(REINFORCED_GLOVES_GAME_OBJECT_NAME); reinforcedGloveRenderer.material.ApplyClonedTexture(); Color[] suitTexturePixels = reinforcedSuitRenderer.material.GetMainTexturePixels(); Color[] armsTexturePixels = reinforcedSuitRenderer.materials[1].GetMainTexturePixels(); Color[] gloveTexturePixels = reinforcedGloveRenderer.material.GetMainTexturePixels(); return(operation => { HsvSwapper reinforcedSuitFilter = new HsvSwapper(colorSwapStrategy); reinforcedSuitFilter.SetHueRange(0f, 20f); reinforcedSuitFilter.SetSaturationRange(45f, 100f); reinforcedSuitFilter.SwapColors(suitTexturePixels); reinforcedSuitFilter.SwapColors(armsTexturePixels); reinforcedSuitFilter.SwapColors(gloveTexturePixels); operation.UpdateIndex(REINFORCED_SUIT_INDEX_KEY, suitTexturePixels); operation.UpdateIndex(REINFORCED_SUIT_ARMS_INDEX_KEY, armsTexturePixels); operation.UpdateIndex(REINFORCED_GLOVES_INDEX_KEY, gloveTexturePixels); }); }
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); }); }