// Start is called before the first frame update void Start() { //Set the both sliders value to the starting health healthSlider.value = GetHealthBarValue(); underBar.value = GetHealthBarValue(); //Create new Smoothsliders for each slider healthBarSmoothSlider = new SmoothSlider(healthSlider, sliderValueChangeTime); underBarSmoothSlider = new SmoothSlider(underBar, sliderValueChangeTime); //get the image renderer for the healthbar slider and assign it to imageRend imageRend = healthSlider.GetComponentInChildren <Image>(); }
void Start() { //Get the world-space canvas worldSpaceCanvas = GameObject.FindGameObjectWithTag("WorldSpaceCanvas"); //Instantiate the loading slider GameObject slider = Instantiate(Resources.Load("Prefabs/Stage/SlidingInfoBar", typeof(GameObject)), (Vector2)transform.position + offset, Quaternion.identity, worldSpaceCanvas.transform) as GameObject; this.slider = slider.GetComponent <SmoothSlider>(); sliderColorFader = slider.GetComponent <ColorFader>(); this.slider.StartAnimation(0, 0); //Set the progress slider to 0% StartCoroutine(updateTimer(colorChangeTime)); //Start the update timer }
void Awake() { //If variables are left null then attempt to search for them automatically if (player == null) { player = GameObject.FindObjectOfType <Player>(); } if (healthBar == null) { healthBar = GameObject.Find(HEALTH_BAR_NAME).GetComponent <SmoothSlider>(); } if (healthText == null) { healthText = GameObject.Find(HEALTH_TEXT_NAME).GetComponent <Notification>(); } if (moneyText == null) { moneyText = GameObject.Find(MONEY_TEXT_NAME).GetComponent <Notification>(); } }
private void Initialize() { ss = go.GetComponent <SmoothSlider>(); image.fillAmount = 0; }