public ColoringComponent CreateNewColoring()
 {
     this.Cancel();
     this.newColoring = new GameObject("NewColoring").AddComponent <ColoringComponent>();
     this.tankConstructor.ChangeColoring(this.newColoring);
     return(this.newColoring);
 }
示例#2
0
 public void BuildTank(GameObject hull, GameObject weapon, ColoringComponent coloring)
 {
     this.CreateHull(hull);
     this.CreateWeapon(weapon);
     this.SetWeaponPosition();
     this.SetColoring(coloring);
 }
 public void Cancel()
 {
     if (this.newColoring != null)
     {
         Destroy(this.newColoring.gameObject);
         this.newColoring = null;
     }
 }
示例#4
0
        public static void ApplyColoring(Renderer renderer, ColoringComponent coloring)
        {
            Material mainMaterial = GetMainMaterial(renderer);

            if (mainMaterial)
            {
                AnimatedPaintComponent component = coloring.GetComponent <AnimatedPaintComponent>();
                if (component != null)
                {
                    component.AddMaterial(mainMaterial);
                }
                mainMaterial.EnableKeyword(TankMaterialPropertyNames.COLORING_KEYWORD);
                mainMaterial.SetColor(TankMaterialPropertyNames.COLORING_ID, (Color)coloring.color);
                if (coloring.coloringTexture != null)
                {
                    mainMaterial.SetTexture(TankMaterialPropertyNames.COLORING_MAP, coloring.coloringTexture);
                }
                else
                {
                    mainMaterial.SetTexture(TankMaterialPropertyNames.COLORING_MAP, null);
                }
                mainMaterial.SetFloat(TankMaterialPropertyNames.METALLIC_COLORING_ID, coloring.metallic);
                mainMaterial.SetFloat(TankMaterialPropertyNames.COLORING_MAP_ALPHA_DEF_ID, (float)coloring.coloringTextureAlphaMode);
                if (coloring.coloringNormalMap != null)
                {
                    mainMaterial.SetTexture(TankMaterialPropertyNames.COLORING_BUMP, coloring.coloringNormalMap);
                    mainMaterial.SetFloat(TankMaterialPropertyNames.COLORING_BUMP_SCALE_ID, coloring.coloringNormalScale);
                    mainMaterial.SetFloat(TankMaterialPropertyNames.COLORING_BUMP_MAP_DEF_ID, 1f);
                }
                else
                {
                    mainMaterial.SetTexture(TankMaterialPropertyNames.COLORING_BUMP, null);
                    mainMaterial.SetFloat(TankMaterialPropertyNames.COLORING_BUMP_SCALE_ID, 1f);
                    mainMaterial.SetFloat(TankMaterialPropertyNames.COLORING_BUMP_MAP_DEF_ID, 0f);
                }
                if (coloring.overwriteSmoothness)
                {
                    mainMaterial.SetFloat(TankMaterialPropertyNames.COLORING_SMOOTHNESS_ID, coloring.smoothnessStrength);
                }
                else
                {
                    mainMaterial.SetFloat(TankMaterialPropertyNames.COLORING_SMOOTHNESS_ID, -1f);
                }
                if (coloring.useColoringIntensityThreshold)
                {
                    mainMaterial.SetFloat(TankMaterialPropertyNames.COLORING_MASK_THRESHOLD_ID, coloring.coloringMaskThreshold);
                }
                else
                {
                    mainMaterial.SetFloat(TankMaterialPropertyNames.COLORING_MASK_THRESHOLD_ID, -1f);
                }
                if (coloring.overrideEmission)
                {
                    mainMaterial.SetFloat(TankMaterialPropertyNames.EMISSION_INTENSITY_ID, coloring.emissionIntensity);
                    mainMaterial.SetColor(TankMaterialPropertyNames.EMISSION_COLOR_ID, coloring.emissionColor);
                }
            }
        }
示例#5
0
        public void OnResultsDropdownChanged()
        {
            int num = this.view.viewerView.resultsDropdownView.dropdown.value - 1;

            if (num >= 0)
            {
                ColoringComponent coloringComponent = this.resultsDataSource.GetColoringComponents()[num];
                this.logic.UpdateColoring(coloringComponent);
            }
        }
 public void SwitchToEditor(ColoringComponent coloringComponent)
 {
     this.creatorView.colorView.SetColor((Color)coloringComponent.color);
     this.creatorView.textureView.SetAlphaMode(coloringComponent.coloringTextureAlphaMode);
     this.creatorView.textureView.textureDropdown.value = 0;
     this.creatorView.normalMapView.SetNormalScale(coloringComponent.coloringNormalScale);
     this.creatorView.normalMapView.normalMapDropdown.value = 0;
     this.creatorView.intensityThresholdView.SetUseIntensityThreshold(coloringComponent.useColoringIntensityThreshold);
     this.creatorView.intensityThresholdView.SetIntensityThreshold(coloringComponent.coloringMaskThreshold);
     this.creatorView.smoothnessView.SetOverrideSmoothness(coloringComponent.overwriteSmoothness);
     this.creatorView.smoothnessView.SetSmoothnessStrenght(coloringComponent.smoothnessStrength);
     this.creatorView.metallicView.SetFloat(coloringComponent.metallic);
     this.creatorView.gameObject.SetActive(true);
     this.viewerView.gameObject.SetActive(false);
 }
示例#7
0
        public void OnCreateColoringButtonClick()
        {
            ColoringComponent coloringComponent = this.logic.CreateNewColoring();

            this.view.SwitchToEditor(coloringComponent);
        }
示例#8
0
 public void Add(string directoryName, ColoringComponent coloring)
 {
     this.folderNames.Add(directoryName);
     this.coloringList.Add(coloring);
     this.onChange();
 }
示例#9
0
 public static void ApplyColoring(Renderer tankRenderer, Renderer weaponRenderer, ColoringComponent tankColoring, ColoringComponent weaponColoring)
 {
     ApplyColoring(tankRenderer, tankColoring);
     if (weaponColoring.gameObject.GetComponent <IgnoreColoringBehaviour>())
     {
         ApplyColoring(weaponRenderer, tankColoring);
     }
     else
     {
         ApplyColoring(weaponRenderer, weaponColoring);
     }
 }
 public void UpdateColoring(ColoringComponent coloringComponent)
 {
     this.tankConstructor.ChangeColoring(coloringComponent);
 }
示例#11
0
 private void SetColoring(ColoringComponent coloring)
 {
     this.coloring = coloring;
     TankMaterialsUtil.ApplyColoring(TankBuilderUtil.GetHullRenderer(this.hullInstance), coloring);
     TankMaterialsUtil.ApplyColoring(TankBuilderUtil.GetWeaponRenderer(this.weaponInstance), coloring);
 }
示例#12
0
 public void ChangeColoring(ColoringComponent coloring)
 {
     this.SetColoring(coloring);
 }