/// <summary> /// Update the current objective color. /// </summary> /// <param name="color"></param> public override void SetColor(RayColor color) { base.SetColor(color); // Changed the color of the object _meshRenderer.material.color = color.GetColor(); }
/// <summary> /// Set the line renderer color /// </summary> private void SetGradientColor() { // Set a gradient with the same color at the beginning and the end (we have to use a Gradient...) var gradient = new Gradient(); gradient.SetKeys( new[] { new GradientColorKey(Color.GetColor(), 0.0f), new GradientColorKey(Color.GetColor(), 1.0f) }, new[] { new GradientAlphaKey(Color.Alpha, 0.0f), new GradientAlphaKey(Color.Alpha, 1.0f) } ); // Apply the gradient LineRenderer.colorGradient = gradient; }
/// <summary> /// Set hthe color of an item. /// </summary> /// <param name="color"></param> public void SetColor(RayColor color) { Color = color; var _image = this.GetComponentInChildren <Image>(); var _text = this.GetComponentInChildren <Text>(); _text.text = Color.GetName(); _image.color = Color.GetColor(); }
private void Start() { // Set enemy color GetComponent <Renderer>().material.color = Color.GetColor(); Life = StartLife; // Navigate enemy to the end _end = GameObject.FindGameObjectWithTag("Finish").transform; _navigationAgent.SetDestination(_end.position); }
/// <summary> /// Set a gradient with the same color at the beginning and the end (we have to use a Gradient...). /// </summary> /// <param name="color"></param> private void SetLineRendererColor(RayColor color) { var gradient = new Gradient(); gradient.SetKeys( new[] { new GradientColorKey(color.GetColor(), 0.0f), new GradientColorKey(color.GetColor(), 1.0f) }, new[] { new GradientAlphaKey(color.Alpha, 0.0f), new GradientAlphaKey(color.Alpha, 1.0f) } ); Debug.Log(gradient); // Apply the gradient LineRenderer.colorGradient = gradient; }
// Update the current filter color public override void SetColor(RayColor color) { base.SetColor(color); // Changed the color of the object foreach (var renderer in _renderers) { renderer.material.color = color.GetColor(); } UpdateEmittedRays(); }