コード例 #1
0
    void SpawnEnemy_3()
    {
        spawnTimer += Time.deltaTime;
        if (spawnTimer >= spawnTime)
        {
            spawnTimer = 0;

            var cannons = GlobalManager.cannons;

            Cannon       randCannon = cannons[Random.Range(0, cannons.Count)];
            EnemyMissile enemy      = Instantiate(prefabDefaultEnemy).GetComponent <EnemyMissile>();
            enemy.transform.position = new Vector3(
                randCannon.transform.position.x
                , ManageSceneSetup.Ins.spawnVerticalRange.y
                , ManageSceneSetup.Ins.playField.transform.position.z);
            enemy.transform.LookAt(randCannon.transform.position);
            enemy.SetDest(randCannon.transform.position);

            GameEventSignals.DoEnemySpawned(enemy);
        }
    }
コード例 #2
0
    void SpawnEnemy_2()
    {
        spawnTimer += Time.deltaTime;
        if (spawnTimer >= ManageWave.Ins.enemySpawnTime)
        {
            spawnTimer = 0;

            var cannons     = GlobalManager.cannons;
            var waveManager = ManageWave.Ins;

            Cannon       randCannon = cannons[Random.Range(0, cannons.Count)];
            EnemyMissile enemy      = Instantiate(
                waveManager.waveBundles[waveManager.waveIndex].enemyGroupBundles[waveManager.enemyGroupsIndex].prefab).GetComponent <EnemyMissile>();
            enemy.transform.position = new Vector3(
                Random.Range(ManageSceneSetup.Ins.spawnHorizontalRange.x, ManageSceneSetup.Ins.spawnHorizontalRange.y)
                , ManageSceneSetup.Ins.spawnVerticalRange.y
                , ManageSceneSetup.Ins.playField.transform.position.z);
            enemy.transform.LookAt(randCannon.transform.position);
            enemy.SetDest(randCannon.transform.position);

            GameEventSignals.DoEnemySpawned(enemy);
        }
    }