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;
            IColorSwapStrategy colorSwapStrategy = new HueSwapper(playerColor);

            SkinnedMeshRenderer stillSuitRenderer = playerModel.GetRenderer(STILL_SUIT_GAME_OBJECT_NAME);

            stillSuitRenderer.material.ApplyClonedTexture();
            stillSuitRenderer.materials[1].ApplyClonedTexture();

            Color[] bodyTexturePixels = stillSuitRenderer.material.GetMainTexturePixels();
            Color[] armsTexturePixels = stillSuitRenderer.materials[1].GetMainTexturePixels();

            return(operation =>
            {
                HsvSwapper stillSuitFilter = new HsvSwapper(colorSwapStrategy);
                stillSuitFilter.SetHueRange(0f, 75f);

                stillSuitFilter.SwapColors(bodyTexturePixels);
                stillSuitFilter.SwapColors(armsTexturePixels);

                operation.UpdateIndex(STILL_SUIT_INDEX_KEY, bodyTexturePixels);
                operation.UpdateIndex(STILL_SUIT_ARMS_INDEX_KEY, armsTexturePixels);
            });
        }
Example #3
0
        public Action <ColorSwapAsyncOperation> CreateColorSwapTask(INitroxPlayer nitroxPlayer)
        {
            GameObject         playerModel       = nitroxPlayer.PlayerModel;
            Color              playerColor       = nitroxPlayer.PlayerSettings.PlayerColor.ToUnity();
            IColorSwapStrategy colorSwapStrategy = new HueSwapper(playerColor);

            SkinnedMeshRenderer basicFinRenderer = playerModel.GetRenderer(FINS_GAME_OBJECT_NAME);

            basicFinRenderer.material.ApplyClonedTexture();

            SkinnedMeshRenderer chargedFinRenderer = playerModel.GetRenderer(CHARGED_FINS_GAME_OBJECT_NAME);

            chargedFinRenderer.material.ApplyClonedTexture();

            SkinnedMeshRenderer glideFinRenderer = playerModel.GetRenderer(GLIDE_FINS_GAME_OBJECT_NAME);

            glideFinRenderer.material.ApplyClonedTexture();

            //All fin models use the same texture.
            Color[] texturePixels = basicFinRenderer.material.GetMainTexturePixels();

            return(operation =>
            {
                HsvSwapper finFilter = new HsvSwapper(colorSwapStrategy);
                finFilter.SetHueRange(0f, 35f);

                finFilter.SwapColors(texturePixels);

                operation.UpdateIndex(FINS_INDEX_KEY, texturePixels);
            });
        }
        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 HueSwapper(playerColor);

            SkinnedMeshRenderer scubaTankRenderer = playerModel.GetRenderer(SCUBA_TANK_GAME_OBJECT_NAME);

            scubaTankRenderer.material.ApplyClonedTexture();

            Color[] texturePixels = scubaTankRenderer.material.GetMainTexturePixels();

            return(operation =>
            {
                HsvSwapper scubaTankFilter = new HsvSwapper(colorSwapStrategy);
                scubaTankFilter.SetHueRange(0f, 30f);

                scubaTankFilter.SwapColors(texturePixels);

                operation.UpdateIndex(SCUBA_TANK_INDEX_KEY, texturePixels);
            });
        }
Example #7
0
        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);
            });
        }
Example #8
0
        public Action <ColorSwapAsyncOperation> CreateColorSwapTask(INitroxPlayer nitroxPlayer)
        {
            GameObject         playerModel       = nitroxPlayer.PlayerModel;
            Color              playerColor       = nitroxPlayer.PlayerSettings.PlayerColor.ToUnity();
            IColorSwapStrategy colorSwapStrategy = new HueSwapper(playerColor);

            SkinnedMeshRenderer rebreatherRenderer = playerModel.GetRenderer(REBREATHER_GAME_OBJECT_NAME);

            rebreatherRenderer.material.ApplyClonedTexture();

            FixRebreatherMaterials(playerModel, rebreatherRenderer);

            Color[] texturePixels = rebreatherRenderer.material.GetMainTexturePixels();

            return(operation =>
            {
                HsvSwapper rebreatherFilter = new HsvSwapper(colorSwapStrategy);
                rebreatherFilter.SetHueRange(0f, 25f);

                rebreatherFilter.SwapColors(texturePixels);

                operation.UpdateIndex(REBREATHER_INDEX_KEY, texturePixels);
            });
        }