Esempio n. 1
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);
 }
Esempio n. 2
0
 public void OnApplicationQuit()
 {
     PlayerPrefs.SetString("AncientTime", System.DateTime.Now.ToString());
     for (int i = 0; i < nbGuard; i++)
     {
         string g = "guard" + i.ToString();
         PlayerPrefs.SetInt(g, guardActive [i]);
     }
     PlayerPrefs.SetInt("LifeGuard", Mathf.Abs(gm.GetLifeGuard() - gm.GetBaseLife()));
     PlayerPrefs.SetFloat("VolumeMusic", sm.GetVolume(0));
     PlayerPrefs.SetFloat("VolumeEffect", sm.GetVolume(1));
     PlayerPrefs.SetInt("LastScore", GetComponent <ScoreManager>().GetScore());
 }
Esempio n. 3
0
 // Use this for initialization
 void Start()
 {
     if (this.gameObject.GetComponent <SpriteRenderer> ().sortingOrder == 1)
     {
         alive = false;
         life  = 0;
     }
     else
     {
         alive = true;
     }
     gameController = GameObject.Find("_GameManager");
     gm             = gameController.GetComponent <GuardManager> ();
     wm             = gameController.GetComponent <WaveManager> ();
     life           = gm.GetLifeGuard();
     lifeSaved      = life;
     tabEnemyBlock  = new GameObject[lifeSaved + 1];
     wave           = wm.GetWave();
     indiceTab      = 0;
 }
Esempio n. 4
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);
    }