private void Awake()
    {
        mapController = GameObject.Find("Map Form").GetComponent <PerlinMapController>();

        layerNameText = transform.Find("General/Layer Name").GetComponent <Text>();

        isVisibleToggle = transform.Find("General/Toggle").GetComponent <Toggle>();
        isVisibleToggle.onValueChanged.AddListener(delegate { SetLayer(); });

        redSlider = transform.Find("Color Sliders/Red/Slider").GetComponent <Slider>();
        redSlider.onValueChanged.AddListener(delegate { SetLayer(); });

        greenSlider = transform.Find("Color Sliders/Green/Slider").GetComponent <Slider>();
        greenSlider.onValueChanged.AddListener(delegate { SetLayer(); });

        blueSlider = transform.Find("Color Sliders/Blue/Slider").GetComponent <Slider>();
        blueSlider.onValueChanged.AddListener(delegate { SetLayer(); });

        fillSlider = transform.Find("Fill Slider/Slider").GetComponent <Slider>();
        fillText   = transform.Find("Fill Slider/Value").GetComponent <Text>();
        fillSlider.onValueChanged.AddListener(delegate { SetLayer(); });

        freqXSlider = transform.Find("Freq X Slider/Slider").GetComponent <Slider>();
        freqXText   = transform.Find("Freq X Slider/Value").GetComponent <Text>();
        freqXSlider.onValueChanged.AddListener(delegate { SetLayer(); });

        freqYSlider = transform.Find("Freq Y Slider/Slider").GetComponent <Slider>();
        freqYText   = transform.Find("Freq Y Slider/Value").GetComponent <Text>();
        freqYSlider.onValueChanged.AddListener(delegate { SetLayer(); });

        octaveSlider = transform.Find("Octave Slider/Slider").GetComponent <Slider>();
        octaveText   = transform.Find("Octave Slider/Value").GetComponent <Text>();
        octaveSlider.onValueChanged.AddListener(delegate { SetLayer(); });

        octaveFreqSlider = transform.Find("Octave Frequency Slider/Slider").GetComponent <Slider>();
        octaveFreqText   = transform.Find("Octave Frequency Slider/Value").GetComponent <Text>();
        octaveFreqSlider.onValueChanged.AddListener(delegate { SetLayer(); });

        octaveAmpSlider = transform.Find("Octave Amplitude Slider/Slider").GetComponent <Slider>();
        octaveAmpText   = transform.Find("Octave Amplitude Slider/Value").GetComponent <Text>();
        octaveAmpSlider.onValueChanged.AddListener(delegate { SetLayer(); });

        // Set a random color.
        redSlider.value   = Random.Range(0, 1f);
        greenSlider.value = Random.Range(0, 1f);
        blueSlider.value  = Random.Range(0, 1f);
    }
예제 #2
0
 private void Start()
 {
     perlinMapController = transform.parent.parent.parent.parent.Find("Map Form").GetComponent <PerlinMapController>();
     SetLayer();
 }