コード例 #1
0
 // 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>();
 }
コード例 #2
0
    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
    }
コード例 #3
0
    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>();
        }
    }
コード例 #4
0
 private void Initialize()
 {
     ss = go.GetComponent <SmoothSlider>();
     image.fillAmount = 0;
 }