示例#1
0
    // Use this for initialization
    void Start()
    {
        var spawnPointCount = waveConfiguration.GetWaypoints().Count;

        if (!waveConfiguration.GetRandomSpawn() && spawnPointCount == 0)
        {
            bool isRandomSpawnOn = waveConfiguration.GetRandomSpawn();
            isRandomSpawnOn = true;
        }

        else
        {
            spawnPoints = waveConfiguration.GetWaypoints();
        }
    }
示例#2
0
    IEnumerator SpawnBEATz(WaveConfiguration waveConfig, GameObject BEAT, GameObject newBEAT)
    {
        if (!waveConfig.GetRandomSpawn())
        {
            // We instantiate BEATz based on the data that the Spawn Pattern is holding.
            newBEAT.GetComponent <SpawnPattern>().SetWaveConfiguration(waveConfig);

            // Cooldown before spawning another BEAT
            yield return(new WaitForSeconds(waveConfig.GetBEATzPerSecond()));
        }

        else
        {
            Vector2 randomBEATPosition = new Vector2(Random.Range(-8, 8), Random.Range(-4, 4));

            // Spawn BEATz in randon position
            Instantiate(BEAT, randomBEATPosition, Quaternion.identity);

            // Cooldown before spawning another BEAT
            yield return(new WaitForSeconds(waveConfig.GetBEATzPerSecond()));
        }
    }