コード例 #1
0
    // Update is called once per frame
    void FixedUpdate()
    {
        spawnLocation = new Vector3(Random.Range(-20.0f, 20.0f), 10, Random.Range(-15.0f, 15.0f));

        pooler.SpawnFromPool("Slime", spawnLocation);

        spawnLocation = new Vector3(Random.Range(-20.0f, 20.0f), 10, Random.Range(-15.0f, 15.0f));

        pooler.SpawnFromPool("Azulito", spawnLocation);
    }
コード例 #2
0
    public GameObject CallingSpawnEnemy(EnemyType type)
    {
        Vector3     position = getRandomSpawnPosition();
        EnemyPooler pool     = EnemyPooler.Instance;

        return(pool.SpawnFromPool(type, position));
    }
コード例 #3
0
    private void OnTriggerEnter2D(Collider2D col)
    {
        if (col.CompareTag("Player"))
        {
            if (numberSpawnedEnemy1 <= 2)
            {
                enemyPooler.SpawnFromPool("Enemy", spawnPoint.position, Quaternion.identity);
                numberSpawnedEnemy1++;
            }

            specialEnemyCountDown++;
            if (specialEnemyCountDown == 5)
            {
                if (numberSpawnedEnemy2 < 1)
                {
                    enemyPooler.SpawnFromPool("Enemy2", spawnPoint.position, Quaternion.identity);
                    numberSpawnedEnemy2++;
                }
            }
        }
    }
コード例 #4
0
ファイル: SpawnEnemy.cs プロジェクト: Arreme/SpainGameJam
    private void spawnMob()
    {
        int alive = 0;

        foreach (GameObject enemy in GameObject.FindGameObjectsWithTag("Enemy"))
        {
            alive++;
        }

        if (GameObject.FindGameObjectWithTag("Spawner").GetComponentInParent <EnemyPooler>().getSize() >= alive)
        {
            enemyPooler.SpawnFromPool("Enemy");
        }
    }
コード例 #5
0
    public void SpawnEnemy()
    {
        LevelManager manager = LevelManager.Instance;
        EnemyPooler  pool    = EnemyPooler.Instance;

        foreach (EnemyAmount eAmount in _enemyAmounts)
        {
            for (int i = 0; i < eAmount.Amount; i++)
            {
                Vector3 position = manager.getRandomSpawnPosition();

                pool.SpawnFromPool(eAmount.Type, position);
            }
        }

        gameObject.SetActive(false);
    }
コード例 #6
0
 private void FixedUpdate()
 {
     enemyPool.SpawnFromPool("Enemy", transform.position, Quaternion.identity);
 }