public void ChangeColor(Color colorToEdit) { currentColor = colorToEdit; savedColor = colorToEdit; prevColor = colorToEdit; aValue = currentColor.a * 255f; rValue = currentColor.r * 255f; gValue = currentColor.g * 255f; bValue = currentColor.b * 255f; aText = aValue.ToString("F0"); rText = rValue.ToString("F0"); gText = gValue.ToString("F0"); bText = bValue.ToString("F0"); currentHSVColor = new HSBColor(currentColor); prevHSVColor = new HSBColor(currentColor); GenerateTextures(); rainbow = MaterialUtils.GenerateRainbowGradient(120, 20); aTexture = MaterialUtils.GenerateGradientTexture(100, 20, Color.black, Color.white); colorField = MaterialUtils.GenerateColorField(colorFieldSize, colorFieldSize, currentHSVColor.ToColor()); WindowPosition = new Rect(Screen.width / 2 - 100, Screen.height / 2f, 210, 100); showWindow = true; }
public UIFloatModifierWindow(EffectFloatModifier mod, bool show) : base((EffectModifier)mod, show) { floatMod = mod; floatNames = MaterialUtils.FindValidShaderProperties(floatMod.GetMaterial(), WaterfallMaterialPropertyType.Float).ToArray(); floatIndex = floatNames.ToList().FindIndex(x => x == floatMod.floatName); GenerateCurveThumbs(mod); }
void Start() { if (m_ToolType == null) { m_GradientButton.gameObject.SetActive(false); } tooltipAlignment = TextAlignment.Center; m_GradientButton.hoverEnter += OnBackgroundHoverEnter; // Display the foreground button actions m_GradientButton.hoverExit += OnActionButtonHoverExit; m_GradientButton.click += OnBackgroundButtonClick; m_FrameRenderer.SetBlendShapeWeight(1, 0f); m_CloseInsetMeshRenderer.SetBlendShapeWeight(0, 100f); m_CloseInsetMaskMeshRenderer.SetBlendShapeWeight(0, 100f); m_CloseButton.hoverEnter += OnBackgroundHoverEnter; // Display the foreground button actions m_CloseButton.hoverExit += OnActionButtonHoverExit; m_CloseButton.click += OnSecondaryButtonClicked; m_CloseButtonContainerCanvasGroup.alpha = 0f; // These materials have already been cloned when instantiating this button m_InsetMaterial = m_InsetMeshRenderer.sharedMaterial; m_CloseInsetMaterial = m_CloseInsetMeshRenderer.sharedMaterial; // These materials have NOT been cloned when instantiating this button m_MaskMaterial = MaterialUtils.GetMaterialClone(m_MaskRenderer); m_CloseButtonMaskMaterial = MaterialUtils.GetMaterialClone(m_CloseInsetMaskMeshRenderer); m_InsetMaterial.SetInt(k_MaterialStencilRefProperty, stencilRef); m_MaskMaterial.SetInt(k_MaterialStencilRefProperty, stencilRef); m_CloseInsetMaterial.SetInt(k_MaterialStencilRefProperty, stencilRef); m_CloseButtonMaskMaterial.SetInt(k_MaterialStencilRefProperty, stencilRef); }
public static NetInfo.Node CreateDCNode(NetInfo.Node template, NetInfo netInfo) { Log.Debug("CreateDCNode called for " + netInfo?.name); var material = MaterialUtils.ContinuesMedianMaterial(netInfo); var mesh = MaterialUtils.ContinuesMedianMesh(netInfo); mesh = mesh?.CutOutRoadSides(); mesh?.Elevate(); if (mesh == null || material == null) { return(null); } mesh.name += "_DC"; material.name += "_DC"; NetInfo.Node node = Copy(template); node.m_mesh = node.m_nodeMesh = mesh; node.m_material = node.m_nodeMaterial = material; node.m_directConnect = true; node.m_connectGroup = NetInfo.ConnectGroup.DoubleTrain; Log.Debug("CreateDCNode sucessful for " + netInfo?.name); node.m_nodeMesh.DumpMesh($"DC mesh for {netInfo.name}"); return(node); }
public override void Setup(AssetData listData) { base.Setup(listData); m_PreviewCoroutine = null; m_VisibilityCoroutine = null; m_AutoHidePreview = false; icon.transform.localScale = Vector3.one; // First time setup if (!m_Setup) { // Cube material might change, so we always instance it MaterialUtils.GetMaterialClone(m_Cube); m_Handle.dragStarted += OnDragStarted; m_Handle.dragging += OnDragging; m_Handle.dragEnded += OnDragEnded; m_Handle.hoverStarted += OnHoverStarted; m_Handle.hoverEnded += OnHoverEnded; m_Handle.getDropObject = GetDropObject; m_Setup = true; } InstantiatePreview(); m_Text.text = listData.name; }
public override void init() { //空子弹可以优化的 不用加到client数组里! if (this.isNullBullet) { this._transform.SetParent(this.scene.bulletLayer, false); return; } if (this._fightEntity.data.ContainsKey("scale")) { this.scale = Convert.ToSingle(this._fightEntity.data["scale"]); } base.init(); this._transform.SetParent(this.scene.bulletLayer, false); ViewUtils.changeColor(this.gameObject, ViewConstant.SHIP_SHADER_NAME, (Dictionary <string, object>)ViewConstant.shipConfig[((ClientPlayerEntity)this.bulletEntity.ownerPlayer).shipId]); for (int i = 0, len = this._particles.Count; i < len; i++) { this._particles[i].reset(); } this.changeView(true); Color color = MaterialUtils.cloneColor(((ClientPlayerEntity)this.bulletEntity.ownerPlayer).getTeamColor(2)); color.a = 0.5f; ViewUtils.changeColorMaterial(this.gameObject, ViewConstant.EFFECT_SHADER_NAME, color); }
void Start() { if (!m_EditorWindowCapture) { m_EditorWindowCapture = GetComponent <EditorWindowCapture>(); } if (!m_RawImage) { m_RawImage = GetComponent <RawImage>(); } if (m_RawImage) { // Texture comes in flipped, so it's necessary to correct it var rect = m_RawImage.uvRect; rect.height *= -1f; m_RawImage.uvRect = rect; } if (!m_RawImage && !m_Material) { var renderer = GetComponent <Renderer>(); m_Material = MaterialUtils.GetMaterialClone(renderer); } if (m_Material) { // Texture comes in flipped, so it's necessary to correct it var scale = m_Material.mainTextureScale; scale.y *= -1f; m_Material.mainTextureScale = scale; } }
void Awake() { m_ScrollLineRenderer.SetVertexCount(4); m_ScrollLineRenderer.useWorldSpace = true; m_ScrollLineRenderer.SetWidth(0f, 0f); m_HintLineMaterial = MaterialUtils.GetMaterialClone(m_MeshRenderer); }
void SetupCustomButtonMaterials(Graphic[] graphics, MainMenuFace face) { const string topGradientProperty = "_ColorTop"; const string bottomGradientProperty = "_ColorBottom"; Material materialClone = null; foreach (var graphic in graphics) { // Assign face gradient to custom buttons on a given face (Settings face: locomotion, snapping, etc) var material = graphic.material; if (material.HasProperty(topGradientProperty)) { if (materialClone == null) { // Only clone the material if a material with a matching property is found in this custom-button/sub-menu materialClone = MaterialUtils.GetMaterialClone(graphic); m_MaterialsToCleanup.Add(materialClone); materialClone.SetColor(topGradientProperty, face.gradientPair.a); if (materialClone.HasProperty(bottomGradientProperty)) { materialClone.SetColor(bottomGradientProperty, face.gradientPair.b); } } graphic.material = materialClone; } } }
void Awake() { m_TopHighlightMaterial = MaterialUtils.GetMaterialClone(m_TopHighlightRenderer); m_TopHighlightMaterial.SetColor(k_TopColorProperty, UnityBrandColorScheme.sessionGradient.a); m_TopHighlightMaterial.SetColor(k_BottomColorProperty, UnityBrandColorScheme.sessionGradient.b); m_TopHighlightMaterial.SetFloat(k_AlphaProperty, 0f); // hide the highlight initially }
public override void Setup(FolderData listData) { base.Setup(listData); // First time setup if (m_CubeRenderer == null) { // Cube material might change for hover state, so we always instance it m_CubeRenderer = m_Cube.GetComponent <Renderer>(); m_NormalColor = m_CubeRenderer.sharedMaterial.color; MaterialUtils.GetMaterialClone(m_CubeRenderer); m_ExpandArrow.dragEnded += ToggleExpanded; m_Cube.dragStarted += SelectFolder; m_Cube.dragEnded += ToggleExpanded; m_Cube.hoverStarted += OnHoverStarted; m_Cube.hoverEnded += OnHoverEnded; } m_CubeTransform = m_Cube.transform; m_Text.text = listData.name; // HACK: We need to kick the canvasRenderer to update the mesh properly m_Text.gameObject.SetActive(false); m_Text.gameObject.SetActive(true); m_ExpandArrow.gameObject.SetActive(listData.children != null); m_Hovering = false; }
public override void Setup(FolderData listData, bool firstTime = true) { base.Setup(listData, firstTime); if (firstTime) { // Cube material might change for hover state, so we always instance it m_CubeRenderer = m_Cube.GetComponent <Renderer>(); m_NormalColor = m_CubeRenderer.sharedMaterial.color; MaterialUtils.GetMaterialClone(m_CubeRenderer); m_ExpandArrow.pointerUp += ToggleExpanded; m_Cube.pointerDown += SelectFolder; m_Cube.pointerUp += ToggleExpanded; m_Cube.hoverStarted += OnHoverStarted; m_Cube.hoverEnded += OnHoverEnded; } m_CubeTransform = m_Cube.transform; m_Text.text = listData.name; m_ExpandArrow.gameObject.SetActive(listData.children != null); m_Hovering = false; }
void Awake() { m_OriginalIconSprite = m_Icon.sprite; m_ButtonMaterial = MaterialUtils.GetMaterialClone(m_ButtonMeshRenderer); m_OriginalLocalScale = transform.localScale; m_OriginalIconLocalPosition = m_IconContainer.localPosition; m_OriginalContentContainerLocalScale = m_ContentContainer.localScale; m_HighlightContentContainerLocalScale = new Vector3(m_OriginalContentContainerLocalScale.x, m_OriginalContentContainerLocalScale.y, m_OriginalContentContainerLocalScale.z * m_HighlightZScaleMultiplier); m_IconHighlightedLocalPosition = m_OriginalIconLocalPosition + Vector3.forward * m_IconHighlightedLocalZOffset; m_IconPressedLocalPosition = m_OriginalIconLocalPosition + Vector3.back * m_IconHighlightedLocalZOffset; m_Icon.color = m_NormalContentColor; #if INCLUDE_TEXT_MESH_PRO m_Text.color = m_NormalContentColor; // Clears/resets any non-sprite content(text) from being displayed if a sprite was set on this button if (m_OriginalIconSprite) { SetContent(m_OriginalIconSprite, m_AlternateIconSprite); } else if (!string.IsNullOrEmpty(m_Text.text)) { SetContent(m_Text.text); } #endif }
protected override void Setup() { base.Setup(); m_TextMaterial = Instantiate(m_TextMaterial); m_ExpandArrowMaterial = Instantiate(m_ExpandArrowMaterial); m_LockIconMaterial = Instantiate(m_LockIconMaterial); m_UnlockIconMaterial = Instantiate(m_UnlockIconMaterial); m_BottomDropZoneMaterial = MaterialUtils.GetMaterialClone(m_BottomDropZone.GetComponent <Renderer>()); m_BottomDropZoneStartHeight = m_BottomDropZone.transform.localScale.z; m_TopDropZoneMaterial = MaterialUtils.GetMaterialClone(m_TopDropZone.GetComponent <Renderer>()); var color = m_TopDropZoneMaterial.color; m_DropZoneAlpha = color.a; color.a = 0; m_TopDropZoneMaterial.color = color; m_BottomDropZoneMaterial.color = color; var dropZones = new[] { m_BottomDropZone, m_TopDropZone }; foreach (var dropZone in dropZones) { dropZone.canDrop = CanDrop; dropZone.receiveDrop = RecieveDrop; dropZone.dropHoverStarted += DropHoverStarted; dropZone.dropHoverEnded += DropHoverEnded; } m_BottomDropZone.gameObject.SetActive(false); // Don't block scroll interaction }
public override void Setup(AssetData listData, bool firstTime) { base.Setup(listData, firstTime); m_PreviewCoroutine = null; m_VisibilityCoroutine = null; m_AutoHidePreview = false; icon.transform.localScale = Vector3.one; // First time setup if (!m_Setup) { // Cube material might change, so we always instance it MaterialUtils.GetMaterialClone(m_Cube); m_Handle.dragStarted += OnDragStarted; m_Handle.dragging += OnDragging; m_Handle.dragging += OnDraggingFeedForward; m_Handle.dragEnded += OnDragEnded; m_Handle.hoverStarted += OnHoverStarted; m_Handle.hoverEnded += OnHoverEnded; m_Handle.getDropObject = GetDropObject; AssetDropUtils.AssignmentDependencies.TryGetValue(data.type, out m_AssignmentDependencyTypes); m_Setup = true; } InstantiatePreview(); m_Text.text = listData.name; }
void Start() { if (this.IsSharedUpdater(this) && m_Preferences == null) { m_Preferences = new Preferences(); // Share one preferences object across all instances foreach (var linkedObject in linkedObjects) { ((SelectionTool)linkedObject).m_Preferences = m_Preferences; } } m_NormalRayColor = this.GetDefaultRayColor(rayOrigin); m_MultiselectRayColor = m_NormalRayColor; m_MultiselectRayColor = MaterialUtils.HueShift(m_MultiselectRayColor, k_MultiselectHueShift); tooltipTarget = ObjectUtils.CreateEmptyGameObject("SelectionTool Tooltip Target", rayOrigin).transform; tooltipTarget.localPosition = k_TooltipPosition; tooltipTarget.localRotation = k_TooltipRotation; m_BlockSelectCube = ObjectUtils.Instantiate(m_BlockSelectCube, transform); m_BlockSelectCube.SetActive(false); m_BlockSelectCubeRenderer = m_BlockSelectCube.GetComponent <Renderer>(); m_BlockSelectSphere = ObjectUtils.Instantiate(m_BlockSelectSphere, transform); m_BlockSelectSphere.SetActive(false); InputUtils.GetBindingDictionaryFromActionMap(m_ActionMap, m_Controls); }
private void InitializePreviewObjects(CustomMaterial customMaterial, Transform transform) { if (customMaterial.GameObject) { materialObject = CreatePreviewMaterial(customMaterial.GameObject, transform); if (materialObject) { // Fix irregular model scales (in most cases) foreach (Transform child in materialObject.GetComponentsInChildren <Transform>(false)) { if (child) { child.localScale = Vector3.one; child.localPosition = Vector3.zero; } } materialObject.transform.localScale = new Vector3(10f, 37.5f, 75f); if (customMaterial.Descriptor.ReplaceMesh) { // Account for custom mesh scale being weird in previews materialObject.transform.localScale *= 0.025f; } Renderer renderer = materialObject.gameObject?.GetComponentInChildren <Renderer>(); MaterialUtils.SetMaterialsColor(renderer?.materials, colorManager.GetObstacleEffectColor()); } } }
public virtual IEnumerator Start() { // In standalone play-mode usage, attempt to get the TrackedObjectInput if (trackedObjectInput == null && m_PlayerInput) { trackedObjectInput = m_PlayerInput.GetActions <TrackedObject>(); } List <Renderer> renderers = new List <Renderer>(); while (renderers.Count == 0) { yield return(null); foreach (var meshRoot in m_ProxyMeshRoots) { // Only add models of the device and not anything else that is spawned underneath the hand (e.g. menu button, cone/ray) renderers.AddRange(meshRoot.GetComponentsInChildren <Renderer>()); } } foreach (var r in renderers) { m_Materials.AddRange(MaterialUtils.CloneMaterials(r)); } // Move controllers up into EVR range, so they render properly over our UI (e.g. manipulators) foreach (var m in m_Materials) { m.renderQueue = k_RendererQueue; } }
public UIColorModifierWindow(EffectColorModifier mod, bool show) : base((EffectModifier)mod, show) { colorMod = mod; colorName = colorMod.colorName; colorNames = MaterialUtils.FindValidShaderProperties(colorMod.GetMaterial(), WaterfallMaterialPropertyType.Color).ToArray(); colorIndex = colorNames.ToList().FindIndex(x => x == colorMod.colorName); GenerateCurveThumbs(mod); }
public void GenerateTextures() { rTexture = MaterialUtils.GenerateGradientTexture(100, 20, new Color(0.0f, currentColor.g, currentColor.b, 1.0f), new Color(1.0f, currentColor.g, currentColor.b, 1.0f)); gTexture = MaterialUtils.GenerateGradientTexture(100, 20, new Color(currentColor.r, 0f, currentColor.b, 1.0f), new Color(currentColor.r, 1f, currentColor.b, 1.0f)); bTexture = MaterialUtils.GenerateGradientTexture(100, 20, new Color(currentColor.r, currentColor.g, 0f, 1.0f), new Color(currentColor.r, currentColor.g, 1f, 1.0f)); swatch = MaterialUtils.GenerateColorTexture(60, 20, currentColor); }
void SetMaterial() { _material = Instantiate(GetComponent <Renderer>().material); MaterialUtils.Emission(_material, true); _material.color = _baseColor; _material.SetColor("_EmissionColor", _flashColor); GetComponent <Renderer>().material = _material; }
public static void uniqueMaterialWithClickableEmission(MeshInstance mesh, out SpatialMaterial material) { // copy the material to be able to set different seedssss material = (SpatialMaterial)mesh.GetSurfaceMaterial(0).Duplicate(true); MaterialUtils.setClickableEmission(material); mesh.SetSurfaceMaterial(0, material); }
void SetColoredBeatValues(BoxColor color) { //Left 90 degrees switch (color) { case BoxColor.Red: xOffset = -xOffsetRef; //if (hitDir == Direction.Left) hitDir = Direction.Right; //Not Needed as Default for Horizontal is Direction.Right MaterialUtils.ChangeMaterialColor(beatMat, gm.diffuseColors[0]); MaterialUtils.ChangeMaterialEmission(beatMat, gm.emissiveColors[0], gm.emissiveIntensities[0]); MaterialUtils.ChangeMaterialColor(markerMat, gm.diffuseColors[0]); MaterialUtils.ChangeMaterialEmission(markerMat, gm.emissiveColors[0], gm.emissiveIntensities[0]); break; case BoxColor.Yellow: xOffset = -xOffsetRef; //if (hitDir == Direction.Left) hitDir = Direction.Right; //Not Needed as Default for Horizontal is Direction.Right MaterialUtils.ChangeMaterialColor(beatMat, gm.diffuseColors[3]); MaterialUtils.ChangeMaterialEmission(beatMat, gm.emissiveColors[3], gm.emissiveIntensities[3]); MaterialUtils.ChangeMaterialColor(markerMat, gm.diffuseColors[3]); MaterialUtils.ChangeMaterialEmission(markerMat, gm.emissiveColors[3], gm.emissiveIntensities[3]); break; case BoxColor.Blue: xOffset = xOffsetRef; if (hitDir == Direction.Right) { hitDir = Direction.Left; } MaterialUtils.ChangeMaterialColor(beatMat, gm.diffuseColors[1]); MaterialUtils.ChangeMaterialEmission(beatMat, gm.emissiveColors[1], gm.emissiveIntensities[1]); MaterialUtils.ChangeMaterialColor(markerMat, gm.diffuseColors[1]); MaterialUtils.ChangeMaterialEmission(markerMat, gm.emissiveColors[1], gm.emissiveIntensities[1]); break; case BoxColor.Green: xOffset = xOffsetRef; if (hitDir == Direction.Right) { hitDir = Direction.Left; } MaterialUtils.ChangeMaterialColor(beatMat, gm.diffuseColors[2]); MaterialUtils.ChangeMaterialEmission(beatMat, gm.emissiveColors[2], gm.emissiveIntensities[2]); MaterialUtils.ChangeMaterialColor(markerMat, gm.diffuseColors[2]); MaterialUtils.ChangeMaterialEmission(markerMat, gm.emissiveColors[2], gm.emissiveIntensities[2]); break; } }
private void Awake() { viewerScale = 1; m_LineRenderer = GetComponent <VRLineRenderer>(); m_LineRendererMeshRenderer = m_LineRenderer.GetComponent <MeshRenderer>(); m_BlinkMaterial = MaterialUtils.GetMaterialClone(m_RoomScaleRenderer); foreach (var renderer in m_LocatorRoot.GetComponentsInChildren <Renderer>()) { renderer.sharedMaterial = m_BlinkMaterial; } if (!m_ToolPoint) { m_ToolPoint = transform; } m_RoomScaleTransform = m_RoomScaleRenderer.transform; m_RoomScaleTransform.parent = m_LocatorRoot; m_RoomScaleTransform.localPosition = Vector3.zero; m_RoomScaleTransform.localRotation = Quaternion.identity; m_Transform = transform; m_LineRenderer.SetVertexCount(m_LineSegmentCount); m_LineRenderer.useWorldSpace = true; m_MotionSpheres = new Transform[m_MotionSphereCount]; for (int i = 0; i < m_MotionSphereCount; i++) { var sphere = ((GameObject)Instantiate(m_MotionIndicatorSphere, m_ToolPoint.position, m_ToolPoint.rotation)).transform; m_MotionSpheres[i] = sphere; sphere.SetParent(m_Transform, false); sphere.name = "motion-sphere-" + i; sphere.gameObject.SetActive(false); var sphereRenderer = sphere.GetComponent <MeshRenderer>(); if (m_MotionSpheresMaterial == null) // Only one material clone is needed { m_MotionSpheresMaterial = MaterialUtils.GetMaterialClone(sphereRenderer); } sphereRenderer.sharedMaterial = m_MotionSpheresMaterial; } m_MotionSphereOriginalScale = m_MotionSpheres[0].localScale; m_CurveLengthEstimate = 1.0f; m_MotionSphereOffset = 0.0f; m_RingTransform = m_RingRenderer.transform; m_RingTransformOriginalScale = m_RingTransform.localScale; m_TubeTransform = m_TubeRenderer.transform; m_TubeTransformOriginalScale = m_TubeTransform.localScale; m_TubeTransformHiddenScale = new Vector3(m_TubeTransform.localScale.x, 0.0001f, m_TubeTransform.localScale.z); ShowLine(false); showValidTargetIndicator = true; }
public static Material CalculateMaterial(Material material, ushort nodeID, ushort segmentID) { if (ShouldHideCrossing(nodeID, segmentID)) { NetInfo netInfo = segmentID.ToSegment().Info; material = MaterialUtils.HideCrossings(material, null, netInfo, lod: false); } return(material); }
public static Mesh CalculateMesh(Mesh mesh, ushort nodeID, ushort segmentID) { if (ShouldContinueMedian(nodeID, segmentID)) { NetInfo netInfo = segmentID.ToSegment().Info; mesh = MaterialUtils.ContinuesMedian(mesh, netInfo, false); } return(mesh); }
protected void DrawColorField() { GUILayout.BeginVertical(); GUILayout.Space(4); Rect tRect = GUILayoutUtility.GetRect(120, 20, GUILayout.Width(sliderWidth)); GUI.DrawTexture(tRect, swatch); GUILayout.Space(4); tRect = GUILayoutUtility.GetRect(150, 20, GUILayout.Width(sliderWidth)); GUI.DrawTexture(tRect, rainbow); hueValue = GUILayout.HorizontalSlider(hueValue, 0f, 1f, GUILayout.Width(sliderWidth)); currentHSVColor = new HSBColor(hueValue, currentHSVColor.s, currentHSVColor.b); tRect = GUILayoutUtility.GetRect(colorFieldSize, colorFieldSize, GUILayout.Width(colorFieldSize)); GUI.DrawTexture(tRect, colorField); var eventType = Event.current.type; if (eventType == EventType.Repaint) { if (Input.GetMouseButtonDown(0)) { Vector2 screenPoint = GUIUtility.GUIToScreenPoint(Event.current.mousePosition); Rect screenRect = GUIUtility.GUIToScreenRect(tRect); if (tRect.Contains(Event.current.mousePosition)) { int x = (int)Mathf.Clamp(Event.current.mousePosition.x - tRect.xMin, 0, sliderWidth); int y = colorFieldSize - (int)Mathf.Clamp(Event.current.mousePosition.y - tRect.yMin, 0, sliderWidth); Color sampled = ((Texture2D)colorField).GetPixel(x, y); Utils.Log($"Color picked at {x}, {y} is {sampled}"); currentHSVColor = new HSBColor(sampled); currentColor = new Color(sampled.r, sampled.g, sampled.b, currentColor.a); aValue = currentColor.a * 255f; rValue = currentColor.r * 255f; gValue = currentColor.g * 255f; bValue = currentColor.b * 255f; aText = aValue.ToString("F0"); rText = rValue.ToString("F0"); gText = gValue.ToString("F0"); bText = bValue.ToString("F0"); } } } GUILayout.EndVertical(); GUILayout.Space(4); if (!currentHSVColor.ToColor().Equals(prevHSVColor.ToColor())) { colorField = MaterialUtils.GenerateColorField(colorFieldSize, colorFieldSize, currentHSVColor.ToColor()); prevHSVColor = currentHSVColor; } }
void Awake() { m_RayMaterial = MaterialUtils.GetMaterialClone(m_LineRenderer.GetComponent <MeshRenderer>()); m_ConeTransform = m_Cone.transform; m_OriginalConeLocalScale = m_ConeTransform.localScale; rayVisible = true; coneVisible = true; }
public UIColorFromLightModifierWindow(EffectColorFromLightModifier mod, bool show) : base((EffectModifier)mod, show) { colorMod = mod; colorNames = MaterialUtils.FindValidShaderProperties(colorMod.GetMaterial(), WaterfallMaterialPropertyType.Color).ToArray(); colorIndex = colorNames.ToList().FindIndex(x => x == colorMod.colorName); lightNames = colorMod.parentEffect.parentModule.GetComponentsInChildren <Light>().Select(x => x.transform.name).ToArray(); lightIndex = lightNames.ToList().FindIndex(x => x == colorMod.lightTransformName); }
private void Start() { if (generateRandomMaterial) { randomMaterial = MaterialUtils.CreateMaterialWithRandomColor($"{gameObject.name}_material"); } Generate(); }