Beispiel #1
0
    private void InitCanvas()
    {
        canvas = GetComponentInChildren <Canvas>();

        foreach (UnityEngine.UI.Text t in userHUD.GetComponentsInChildren <UnityEngine.UI.Text>())
        {
            if (t.gameObject.name.Equals("User Name"))
            {
                charName = t;
            }
        }
        foreach (UnityEngine.UI.Image g in userHUD.GetComponentsInChildren <UnityEngine.UI.Image>())
        {
            if (g.gameObject.name.Equals("User HUD 1"))
            {
                userHUD1 = g;
            }
            else if (g.gameObject.name.Equals("User HUD 2"))
            {
                userHUD2 = g;
            }
            else if (g.gameObject.name.Equals("User HUD 3"))
            {
                userHUD3 = g;
            }
            else if (g.gameObject.name.Equals("User HUD 4"))
            {
                userHUD4 = g;
            }
        }
        foreach (UnityEngine.UI.Image g in canvas.GetComponentsInChildren <UnityEngine.UI.Image>())
        {
            if (g.gameObject.name.Equals("Mouse HUD"))
            {
                mouseHUD = g;
            }
        }

        foreach (UnityEngine.UI.Text t in userHUD4.GetComponentsInChildren <UnityEngine.UI.Text>())
        {
            if (t.name.Equals("Estado State"))
            {
                userHUDState = t;
            }
        }

        userHUDVariables.SetActive(false);
        userHUD.gameObject.SetActive(false);
        noTargetHUD.SetActive(false);
        mouseHUD.gameObject.SetActive(false);
    }