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); }
public int GetNumberMonster() { if (firstGame) { return(firstWave); } else { System.TimeSpan time = System.DateTime.Now - ancientTime; float hours = (float)time.TotalHours; Debug.Log(" hours " + Mathf.Sqrt(hours) + " nbGuard " + Mathf.Sqrt(gm.nbGuards) + " lifeGuard " + gm.GetLifeGuard() + " coeff " + coeffDifficulty); int nbMonster = (int)(Mathf.Log(hours) * Mathf.Log(gm.GetNbGuardsActive()) * Mathf.Log(gm.GetLifeGuard()) * coeffDifficulty * 100f); //Nombre de vague par heure return(nbMonster); } }
// 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); }