예제 #1
0
 void InitializeEvent()
 {
     events.startGame.AddListener(() => {
         hud.StartBar(sizeLevel);
         generate.enabled = true;
         entityPlayer.GetComponent <PlayerController>().lockMove = false;
     });
     events.death.AddListener((int c) => {
         coins = c;
         if (!reborn)
         {
             hud.OnRebornMenu();
         }
         else
         {
             events.gameOver.Invoke();
         }
     });
     events.reborn.AddListener(() => {
         //Рекламма
         RebornPlayer();
         hud.OffRebornMenu();
         reborn = true;
     });
     events.gameOver.AddListener(() => {
         hud.OffRebornMenu();
         hud.DeathMenu();
         GameManager.events.gameOver.Invoke(coins);
     });
     events.doubleCoins.AddListener(() => {
         hud.DoubleCoinsComplete();
         GameManager.events.addCoins.Invoke(coins);
         coins            *= 2;
         hud.winCoins.text = coins.ToString();
     });
     events.nextLevel.AddListener(() => {
         GameManager.events.nextLevel.Invoke();
     });
     events.win.AddListener(() => {
         GameManager.events.completeLEvel.Invoke(coins);
         hud.CompleteLevel();
     });
     events.adDoubleCoins.AddListener(() => {
         AdManager.events.rewardAd.Invoke(events.doubleCoins);
     });
     events.adReborn.AddListener(() => {
         AdManager.events.rewardAd.Invoke(events.reborn);
     });
 }