Exemplo n.º 1
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);
            });
        }
Exemplo n.º 2
0
        public Action <ColorSwapAsyncOperation> CreateColorSwapTask(INitroxPlayer nitroxPlayer)
        {
            GameObject         playerModel       = nitroxPlayer.PlayerModel;
            Color              playerColor       = nitroxPlayer.PlayerSettings.PlayerColor.ToUnity();
            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);
            });
        }
Exemplo n.º 3
0
        public Action <ColorSwapAsyncOperation> CreateColorSwapTask(INitroxPlayer nitroxPlayer)
        {
            GameObject         playerModel       = nitroxPlayer.PlayerModel;
            Color              playerColor       = nitroxPlayer.PlayerSettings.PlayerColor.ToUnity();
            IColorSwapStrategy colorSwapStrategy = new HueSwapper(playerColor);

            SkinnedMeshRenderer diveSuitRenderer = playerModel.GetRenderer(DIVE_SUIT_GAME_OBJECT_NAME);

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

            Color[] bodyTexturePixels = diveSuitRenderer.material.GetMainTexturePixels();
            Color[] armTexturePixels  = diveSuitRenderer.materials[1].GetMainTexturePixels();

            return(operation =>
            {
                HsvSwapper diveSuitFilter = new HsvSwapper(colorSwapStrategy);
                diveSuitFilter.SetHueRange(5f, 45f);

                diveSuitFilter.SwapColors(bodyTexturePixels);
                diveSuitFilter.SwapColors(armTexturePixels);

                operation.UpdateIndex(DIVE_SUIT_INDEX_KEY, bodyTexturePixels);
                operation.UpdateIndex(DIVE_SUIT_ARMS_INDEX_KEY, armTexturePixels);
            });
        }
        public Action <ColorSwapAsyncOperation> CreateColorSwapTask(INitroxPlayer nitroxPlayer)
        {
            GameObject         playerModel       = nitroxPlayer.PlayerModel;
            Color              playerColor       = nitroxPlayer.PlayerSettings.PlayerColor.ToUnity();
            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.ToUnity();

            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 radiationTankRenderer = playerModel.GetRenderer(RADIATION_TANK_GAME_OBJECT_NAME);

            radiationTankRenderer.material.ApplyClonedTexture();

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

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

                radiationTankFilter.SwapColors(texturePixels);

                operation.UpdateIndex(RADIATION_SUIT_TANK_INDEX_KEY, texturePixels);
            });
        }
Exemplo n.º 7
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);
            });
        }