Example #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);
    }
Example #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;
    }
Example #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);
        }
    }
Example #4
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);
        }
    }