예제 #1
0
    public void SpawnVoxelsAndReturnToPool(bool spawnEnergyVoxels = true)
    {
        EnemyExplosionController explosion = rsc.poolMng.enemyExplosionPool.GetObject();
        Vector3 pos = transform.position;

        if (spawnEnergyVoxels)
        {
            if (explosion != null)
            {
                explosion.transform.position = pos;
                explosion.Play(color, explosion2SoundFx);
            }

            EnergyVoxelPool pool = rsc.poolMng.energyVoxelPool;
            for (int i = 0; i < energyVoxelsSpawnedOnDie; ++i)
            {
                EnergyVoxelController voxel = pool.GetObject();
                if (voxel != null)
                {
                    voxel.transform.position = pos;
                    voxel.transform.rotation = Random.rotation;
                }
            }

            rsc.eventMng.TriggerEvent(EventManager.EventType.ENERGY_VOXEL_SPAWNED, EventInfo.emptyInfo);
        }
        else
        {
            if (explosion != null)
            {
                explosion.transform.position = pos;
                explosion.PlayAudioOnly(explosionWrongColorSoundFx);
            }
        }

        SpawnVoxels();
        rsc.poolMng.spiderPool.AddObject(this);
    }
    public void SpawnVoxelsAndReturnToPool(bool spawnEnergyVoxels = true)
    {
        EnemyExplosionController explosion = rsc.poolMng.enemyExplosionPool.GetObject();
        Vector3 pos = transform.position;

        if (spawnEnergyVoxels)
        {
            if (explosion != null)
            {
                explosion.transform.position = pos;
                explosion.Play(color, explosion2SoundFx);
            }

            EnergyVoxelPool pool = rsc.poolMng.energyVoxelPool;
            for (int i = 0; i < energyVoxelsSpawnedOnDie; ++i)
            {
                EnergyVoxelController voxel = pool.GetObject();
                if (voxel != null)
                {
                    voxel.transform.position = pos;
                    voxel.transform.rotation = Random.rotation;
                }
            }
        }
        else
        {
            if (explosion != null)
            {
                explosion.transform.position = pos;
                explosion.PlayAudioOnly(explosionWrongColorSoundFx);
            }
        }

        SpawnVoxels();
        rsc.poolMng.mosquitoPool.AddObject(this);
    }