Пример #1
0
    public PB_SpawnerWave[] waves;                                              // holds all the enemy waves in the game

    public void Start()
    {
        if (instance != null)
        {
            Destroy(gameObject);
        }
        else
        {
            instance = this;
            DontDestroyOnLoad(gameObject);
        }
        //Start waves
        _currentWave = _startWave;                                                                                                                              // Sets the wave to start the game with
        InvokeRepeating("Wave", _waveDelay / Mathf.Abs(PB_GameController.instance._gameSpeed), _enemyDelay / Mathf.Abs(PB_GameController.instance._gameSpeed)); // Repeating waves besed on enemydelay and wavedeley
    }
Пример #2
0
    public static PB_Spawner instance;          // PB_Spawner is a singleton. EnemySpawner.instance.DoSomeThing();

    public void OnApplicationQuit()             // Ensure that the instance is destroyed when the game is stopped in the editor.
    {
        instance = null;
    }