Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI needs to be anchored and set to top left corner of screen instead of obscuring player view. #3

Open
kilgoreandy opened this issue Feb 19, 2023 · 1 comment

Comments

@kilgoreandy
Copy link

image

This needs to be anchored, out of the way, while still displaying the information needed.

@kilgoreandy
Copy link
Author

kilgoreandy commented Feb 19, 2023

@gamingdynamo
One possible fix would be to set the vector location of both bars in the ui manager start

using UnityEngine;

public class UIManager : MonoBehaviour
{
[SerializeField] private GameObject playerHealth;
[SerializeField] private GameObject towerHealth;
[SerializeField] private GameObject deathScreen;
[SerializeField] private GameObject mainMenu;
[SerializeField] private GameObject upgradeMenu;
[SerializeField] private GameObject waveCounter;
[SerializeField] private GameObject countDown;

private void Start()
{
    // Move health bars to top left corner
    playerHealth.transform.position = new Vector3(200,386,0);
    towerHealth.transform.position = new Vector3(200,426,0);
}

public void EnableUi(string name)
{
    if (name.Equals("PlayerHealth"))
    {
        playerHealth.active = true;
    }
    else if (name.Equals("TowerHealth"))
    {
        towerHealth.active = true;
    }
    else if (name.Equals("DeathScreen"))
    {
        deathScreen.active = true;
    }
    else if (name.Equals("MainMenu"))
    {
        mainMenu.active = true;
    }
    else if (name.Equals("UpgradeMenu"))
    {
        upgradeMenu.active = true;
    }
    else if (name.Equals("waves"))
    {
        waveCounter.active = true;
        countDown.active = true;
    }
}

public void DisableUi(string name)
{
    if (name.Equals("PlayerHealth"))
    {
        playerHealth.active = false;
    }
    else if (name.Equals("TowerHealth"))
    {
        towerHealth.active = false;
    }
    else if (name.Equals("DeathScreen"))
    {
        deathScreen.active = false;
    }
    else if (name.Equals("MainMenu"))
    {
        mainMenu.active = false;
    }
    else if (name.Equals("UpgradeMenu"))
    {
        upgradeMenu.active = false;
    }
    else if (name.Equals("waves"))
    {
        waveCounter.active = false;
        countDown.active = false;
    }
}

}

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant