Пример #1
0
 void SpawningNewOpponent()
 {
     if (currentOpponent != null)
     {
         var coroutine = StartCoroutine(currentOpponent.RunningAway(() =>
         {
             UserInfo.Instance.GearAmount += 5;
             DestroyImmediate(currentOpponent.gameObject);
             currentOpponent = GameObject.Instantiate(enemyPrefab, spawnPoint);
             currentOpponent.Init();
             StartCoroutine(currentOpponent.Coming(() =>
             {
                 progressBar.Init(enemyLife);
             }));
         }));
     }
     else
     {
         currentOpponent = GameObject.Instantiate(enemyPrefab, spawnPoint);
         currentOpponent.Init();
         progressBar.Init(enemyLife);
         StartCoroutine(currentOpponent.Coming(() =>
         {
         }));
     }
 }