Advertisement
SizilStank

Untitled

May 3rd, 2019
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.23 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.SceneManagement;
  5.  
  6. public class Spawn_Manager : MonoBehaviour
  7. {
  8.     public GameStatus _gameStatus;
  9.     public GameObject[] _powerUp;
  10.     public Ball _ball;
  11.     public SceneLoader _sceneLoader;
  12.     public GameObject spawner;
  13.  
  14.    
  15.     // Start is called before the first frame update
  16.     void Start()
  17.     {    
  18.         _sceneLoader = GameObject.Find("SceneLoader").GetComponent<SceneLoader>();
  19.         _gameStatus = GameObject.Find("GameStatus").GetComponent<GameStatus>();
  20.         //StartCoroutine(PowerUpSpawnRoutine());
  21.     }
  22.  
  23.     // Update is called once per frame
  24.     void Update()
  25.     {
  26.        
  27.     }
  28.  
  29.     public void StartSpawnRoutines()
  30.     {
  31.         //StartCoroutine(EnemySpwanRoutine());
  32.         StartCoroutine(PowerUpSpawnRoutine());
  33.     }
  34.  
  35.     IEnumerator PowerUpSpawnRoutine()
  36.     {
  37.         while (_gameStatus.gameStatusCount <= 1)
  38.         {
  39.             int randomPowerup = Random.Range(0, 2);
  40.             Instantiate(_powerUp[randomPowerup], new Vector3(Random.Range(0.62f, 15.32f), 13, 0), Quaternion.identity);
  41.             yield return new WaitForSeconds(8.0f);
  42.  
  43.            
  44.         }
  45.  
  46.     }
  47.  
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement