public Slider _radSlider; //slider reference /// <summary> /// Grabs configurations and script references /// </summary> void Start() { _configuration = _gameManager.GetComponent <JSONconfig>(); _inflateIncrement = _configuration.loadedConfig.inflateIncrement; _deflateIncrement = _configuration.loadedConfig.deflateIncrement; _sliderHandler = _gameManager.GetComponent <gm_slidebarhandler>(); _uiUpdate = _gameManager.GetComponent <gm_uiValuesUpdate>(); }
/// <summary> /// Setup, grab components /// </summary> void Start() { //JSONconfig config = GameObject.Find("ROOT/GAMEMANAGER").GetComponent<JSONconfig>(); //float maxSpeed = config.config.maxWindSpeed; //float minSpeed = config.config.minWindSpeed; //anchor = GameObject.Find("ROOT/WEIGHT").GetComponent<Rigidbody2D>(); pulseMagnitude = 8f; pulseFrequency = 0.5f; turbulence = 10; windSlider = GameObject.Find("ROOT/UI/CPANEL_RIGHT/CPANEL_BOTTOM_R/PANEL_WIND/SLIDER_CONTAINER/SLIDER_WIND").GetComponent <Slider>(); windSlider.minValue = _configuration.loadedConfig.minWindSpeed; windSlider.maxValue = _configuration.loadedConfig.maxWindSpeed; windSlider.value = _configuration.loadedConfig.minWindSpeed; string minString = windSlider.minValue.ToString() + " m/s"; string maxString = windSlider.maxValue.ToString() + " m/s"; _textMin.text = minString; _textMax.text = maxString; windText = GameObject.Find("ROOT/UI/CPANEL_RIGHT/CPANEL_BOTTOM_R/PANEL_WIND/PANEL_SLIDER_VALUE_HOLDER/TEXT_SELECTED").GetComponent <Text>(); GameObject.Find("ROOT/UI/CPANEL_RIGHT/CPANEL_BOTTOM_R/PANEL_WIND/SLIDER_CONTAINER/TEXT_SLIDER_MAX").GetComponent <Text>().text = maxString; windSlider.onValueChanged.AddListener( delegate { SetStrength(windSlider.value); } ); balloon = GameObject.Find("ROOT/BALLOON").GetComponent <Rigidbody2D>(); if (balloon.transform.GetComponent <SpringJoint2D>()) { balloon.transform.GetComponent <SpringJoint2D>().enabled = false; } anchor = GameObject.Find("ROOT/WEIGHT").GetComponent <Rigidbody2D>(); rope_restrictballmovement rope = anchor.GetComponent <rope_restrictballmovement>(); prop = GameObject.Find("ROOT/GAMEMANAGER").GetComponent <gm_uiValuesUpdate>(); rope.bounds[0] *= 1.5f; rope.bounds[1] *= 1.5f; constForce = balloon.GetComponent <ConstantForce2D>(); constForce.force *= (Vector2.up * 1.2f); forceY = constForce.force.y; startingPosition = balloon.transform.position; startingPosition = new Vector2(0, startingPosition.y); lowFrequencyNoise = new float[1024]; //start with white noise in [0,1] for (int i = 0; i < lowFrequencyNoise.Length; i++) { lowFrequencyNoise[i] = Random.value; } //perform gaussian smoothing (twice) as a simple low-pass filter GaussianSmooth(lowFrequencyNoise); GaussianSmooth(lowFrequencyNoise); }