Esempio n. 1
0
 public int[] SetGuardActive()
 {
     nbGuard     = gm.GetNbGuards();
     guardActive = new int[nbGuard];
     for (int i = 0; i < nbGuard; i++)
     {
         string g = "guard" + i.ToString();
         if (PlayerPrefs.HasKey(g))
         {
             guardActive [i] = PlayerPrefs.GetInt(g);
         }
         else
         {
             guardActive [i] = 0;
         }
     }
     return(guardActive);
 }
Esempio n. 2
0
    // Use this for initialization
    public void SetupUI()
    {
        gm         = GetComponent <GuardManager> ();
        wm         = GetComponent <WaveManager> ();
        mainCanvas = new GameObject("Canvas");
        CreateCanvas(mainCanvas, "UI");
        instanceMenu   = new GameObject[buttonTab.Length + 2];
        instanceVolume = new Slider[sliderVolume.Length];
        volume         = new float[2];
        if (PlayerPrefs.HasKey("VolumeMusic"))
        {
            volume[0] = PlayerPrefs.GetFloat("VolumeMusic");
            volume[1] = PlayerPrefs.GetFloat("VolumeEffect");
        }
        else
        {
            volume[0] = 0.5f;
            volume[1] = 0.5f;
        }

        textNbGuard   = "Nombres de gardes : " + gm.GetNbGuardsActive() + "/" + gm.GetNbGuards();
        textLifeGuard = "Vie des gardes : " + gm.GetLifeGuard();
        AddButton(buttonTab, posButtonTab, new Vector2(0, 0), mainCanvas);
        instanceBar = new Image[bar.Length];
        AddImage(bar, posBar, mainCanvas);
        TextMenu("Score", new Vector2(0.7f, 1f), new Vector2(0.3f, 0.9f), myCanvas.gameObject, new Color(1f, 1f, 0f, 1f));

        mainCanvas = new GameObject("EventSystem");
        mainCanvas.AddComponent <EventSystem> ();
        mainCanvas.AddComponent <StandaloneInputModule> ();
        mainCanvas.transform.SetParent(myCanvas.transform);

        for (int i = 0; i < buttonTab.Length; ++i)
        {
            CreateMenu(buttonTab[i].name, new Color(0f, 0f, 0f, 0.5f), new Color(0.5f, 0.5f, 0.5f, 1f), buttonMenu, posButtonMenu, i);
        }
        CreateMenu("Coffre du jour", new Color(0f, 0f, 0f, 0.5f), new Color(0.5f, 0.5f, 0.5f, 1f), buttonChest, posButtonChest, buttonTab.Length);
        CreateMenu("Création des potions", new Color(0f, 0f, 0f, 0.5f), new Color(0.5f, 0.5f, 0.5f, 1f), buttonPotion, posButtonPotion, buttonTab.Length + 1);
    }
Esempio n. 3
0
 public void Upgrade()
 {
     GameState.freezeTime();
     instanceNbGuard.text   = "Nombres de gardes : " + gm.GetNbGuardsActive() + "/" + gm.GetNbGuards();
     instanceLifeGuard.text = "Vie des gardes : " + gm.GetLifeGuard();
     instanceMenu [2].SetActive(true);
 }