using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using System;
using System.Linq;
using System.Collections.Generic;
public class RedBehaviourScript : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
public void myfunred()
{
float rnum=0;
rnum=GameObject.Find("RedSlider").GetComponent<Slider>().value;
Text mytxt=GameObject.Find("RedText").GetComponent<Text>();
mytxt.text =rnum.ToString();
Image img = GameObject.Find ("RedImage").GetComponent<Image> ();
img.color = new Color(rnum, 0.0F, 0.0F, 1.0F); // (紅red,綠green,藍blue,透明)
}
public void myfunblue()
{
float bnum=0;
bnum=GameObject.Find("BlueSlider").GetComponent<Slider>().value;
Text mytxt=GameObject.Find("BlueText").GetComponent<Text>();
mytxt.text =bnum.ToString();
Image img = GameObject.Find ("BlueImage").GetComponent<Image> ();
img.color = new Color(0.0F, 0.0F, bnum, 1.0F); // (紅red,綠green,藍blue,透明)
}
public void myfungreen()
{
float gnum=0;
gnum=GameObject.Find("GreenSlider").GetComponent<Slider>().value;
Text mytxt=GameObject.Find("GreenText").GetComponent<Text>();
mytxt.text =gnum.ToString();
Image img = GameObject.Find ("GreenImage").GetComponent<Image> ();
img.color = new Color(0.0F, gnum, 0.0F, 1.0F); // (紅red,綠green,藍blue,透明)
}
public void myfuntotal()
{
float rnum=0,bnum=0,gnum=0;
rnum=GameObject.Find("RedSlider").GetComponent<Slider>().value;
bnum=GameObject.Find("BlueSlider").GetComponent<Slider>().value;
gnum=GameObject.Find("GreenSlider").GetComponent<Slider>().value;
//Text mytxt=GameObject.Find("RedText").GetComponent<Text>();
//mytxt.text =rnum.ToString();
Image img = GameObject.Find ("TotalImage").GetComponent<Image> ();
img.color = new Color(rnum, gnum, bnum, 1.0F); // (紅red,綠green,藍blue,透明)
}
}
沒有留言:
張貼留言