Exemplo n.º 1
0
    private void updateHealthbar()
    {
        bool show = healthbar.isOnScreen() && (IsHovered() || IsSelected()) && isVisible;

        healthbar.gameObject.SetActive(show);
        healthbar.SetWorldPos(transform.position + Vector3.up * 1.0f);
        healthbar.SetPercentage((float)healthCurrent / healthMax);
    }
Exemplo n.º 2
0
    private void updateResourceBar()
    {
        bool show = resourceBar.isOnScreen() && (IsHovered() || lastHarvestTime < 1.0f) && isVisible;

        resourceBar.gameObject.SetActive(show);
        resourceBar.SetWorldPos(transform.position + Vector3.up * 1.5f);
        resourceBar.SetPercentage(resourceAmount);
        resourceBar.offset = shakeOffset;
    }
Exemplo n.º 3
0
    private void updateProgressBar()
    {
        bool show = progressBar.isOnScreen() && unitBuildQueue.Count > 0;

        progressBar.gameObject.SetActive(show);
        progressBar.SetWorldPos(transform.position + Vector3.up * 1.5f);
        if (show)
        {
            progressBar.SetPercentage(buildTick / unitBuildQueue[0].buildTime);
        }
    }
Exemplo n.º 4
0
 public override void TakeHit(float damage, string tag)
 {
     base.TakeHit(damage, tag);
     if (!alive)
     {
         Destroy(healthbar);
     }
     else
     {
         healthbar.SetPercentage(currentHealth / startingHealth);
     }
 }
Exemplo n.º 5
0
 void Update()
 {
     if (unit != null)
     {
         healthbar.SetPercentage(unit.healthCurrent / unit.healthMax);
         bool borderActive = unit.IsSelected() || isHovered;
         border.gameObject.SetActive(borderActive);
         if (borderActive)
         {
             border.color = unit.IsSelected() ? unit.outlineColourSelected : unit.outlineColourHovered;
         }
     }
 }
Exemplo n.º 6
0
    private void updateProgressBar()
    {
        bool show = progressBar.isOnScreen() && isBuilding;

        progressBar.gameObject.SetActive(show);
        if (targetTile != null)
        {
            progressBar.SetWorldPos(targetTile.worldPos + Vector3.up * 1.5f);
        }
        if (show)
        {
            progressBar.SetPercentage(buildAmount / structureToBuild.buildTime);
        }
    }