示例#1
0
 public void Play()
 {
     fighting        = false;
     this.playerData = new PlayerData(username);
     SceneManager.LoadScene(1);
     championPrepController = new ChampionPrepController();
     championPrepController.RespawnAllies();
 }
示例#2
0
 // Update is called once per frame
 void Update()
 {
     if (fighting == false && gameManager.fighting == true)
     {
         DisableUI();
         fighting = true;
     }
     else if (fighting == true && gameManager.fighting == false)
     {
         if (playerData.GetHealth() <= 0)
         {
             GameOver(false);
         }
         else
         {
             EnableUI();
             refreshStore();
             UnityEngine.Debug.Log("++ lvl " + gameManager.GameLevel + "sur " + gameManager.GetLevelNumbers());
             if (gameManager.GameLevel < gameManager.GetLevelNumbers())
             {
                 championPrepController.RespawnAllies();
                 championPrepController.SpawnEnemyChampions(gameManager.GameLevel);
                 //update UI with bool win
                 if (gameManager.PlayerWonTheFight)
                 {
                     result.text = "Victory ! Stage : " + gameManager.GameLevel.ToString();
                 }
                 else
                 {
                     result.text = "Defeat ! Stage : " + gameManager.GameLevel.ToString();
                 }
             }
             else
             {
                 GameOver(true);
             }
             fighting = false;
         }
     }
     if (playerData != null)
     {
         if (playerData.uptodate == false)
         {
             //update de l'ui
             healthBar.fillAmount = 1.0f * playerData.GetHealth() / 100.0f;
             xpBar.fillAmount     = playerData.GetXp();
             if (xpBar.fillAmount == 1.0f)
             {
                 xpBar.fillAmount = 0.0f;
             }
             level.text          = playerData.GetLevel().ToString();
             gold.text           = playerData.GetGold().ToString();
             playerData.uptodate = true;
         }
     }
 }