예제 #1
0
    private void SpawnWeapon()
    {
        int        weaponIndex  = Random.Range(0, spawnedPrefabs.Length);
        GameObject weaponPrefab = spawnedPrefabs[weaponIndex];

        Vector3     pos           = GetSpawnPosition();
        GameObject  spawnerObject = Instantiate(spawnerPrefab, pos, Quaternion.identity);
        ObjectSpawn spawner       = spawnerObject.GetComponent <ObjectSpawn>();

        spawner.SetPrefabToSpawn(weaponPrefab, this);
    }