void Start()
    {
        if (instance != null)
        {
            Destroy(gameObject);
            return;
        }

        instance = this;
    }
示例#2
0
    private float maxIndex; //the highest value


    IEnumerator spawnWave(waveSpawner nextWave)
    {
        int int_framesUntilCall = nextWave.int_startDelayFrames;

        while (int_framesUntilCall > 0)
        {
            int_framesUntilCall--;
            yield return(new WaitForFixedUpdate());
        }
        Instantiate(nextWave.spawner, Vector3.zero, Quaternion.identity);
        int_framesUntilSpawn = nextWave.int_endDelayFrames;
        yield break;
    }
示例#3
0
    // Update is called once per frame
    void FixedUpdate()
    {
        if (int_framesUntilSpawn <= 0 && !bl_isCallingWave)
        {
            bl_isCallingWave = true;

            if (fl_spawnIndices.Length == 1)
            {
                nextSpawner = spawnerSet[0];
            }
            else
            {
                nextSpawner = spawnerSet[getSpawnerFromIndex(Random.Range(0.0f, maxIndex))];
            }

            StartCoroutine(spawnWave(nextSpawner));
        }

        int_framesUntilSpawn--;
    }
示例#4
0
 private void Start()
 {
     QApanel.SetActive(false);
     ws = GameObject.FindObjectOfType <waveSpawner>();  //only one object has wave spawner script attached to it
 }