Beispiel #1
0
    private IEnumerator RandomizeAndExplode()
    {
        float elapsedTime = 0;
        int   chargeLevel = 0;

        while (elapsedTime < bb.bodyColorsCarrouselMinTime)
        {
            SetMaterial(rsc.coloredObjectsMng.GetWormHeadMaterial(chargeLevel++ % 4));

            yield return(new WaitForSeconds(bb.bodyColorsCarrouselChangeInterval));

            elapsedTime += bb.bodyColorsCarrouselChangeInterval;
        }

        EnemyExplosionController explosion = rsc.poolMng.enemyExplosionPool.GetObject();

        if (explosion != null)
        {
            explosion.transform.position = transform.position;
            explosion.PlayAll(finalExplosionSoundFx);
        }

        rsc.rumbleMng.Rumble(0, 1.5f, 1f, 1f);
        rsc.camerasMng.PlayEffect(0, 1.5f, 0.75f);
        voxelization.SpawnFakeVoxels();
        headModel.SetActive(false);

        yield return(new WaitForSeconds(2f));

        //rsc.eventMng.TriggerEvent(EventManager.EventType.LEVEL_CLEARED, LevelEventInfo.eventInfo);
        rsc.eventMng.TriggerEvent(EventManager.EventType.WORM_DIED, EnemyDiedEventInfo.eventInfo);

        //Destroy(gameObject);
        gameObject.SetActive(false);
    }
    private IEnumerator RandomizeAndExplode()
    {
        float       elapsedTime = 0;
        ChromaColor randomColor = ChromaColorInfo.Random;

        while (elapsedTime < bb.bodyColorsCarrouselMinTime)
        {
            randomColor = ChromaColorInfo.Random;
            SetMaterial(rsc.coloredObjectsMng.GetWormBodyMaterial(randomColor));

            yield return(new WaitForSeconds(bb.bodyColorsCarrouselChangeInterval));

            elapsedTime += bb.bodyColorsCarrouselChangeInterval;
        }

        bodyDeactivate[(int)randomColor].Play();
        voxelization.SpawnFakeVoxels();

        EnemyExplosionController explosion = rsc.poolMng.enemyExplosionPool.GetObject();

        if (explosion != null)
        {
            explosion.transform.position = transform.position;
            explosion.PlayAll(finalExplosionSoundFx);
        }

        rsc.rumbleMng.Rumble(0, 0.3f, 0.5f, 0.5f);
        rsc.camerasMng.PlayEffect(0, 0.3f, 0.25f);
        //Destroy(gameObject);
        gameObject.SetActive(false);
    }
    public void SpawnVoxels()
    {
        voxelization.CalculateVoxelsGrid();
        voxelization.SpawnVoxels();

        EnemyExplosionController explosion = rsc.poolMng.enemyExplosionPool.GetObject();

        if (explosion != null)
        {
            explosion.transform.position = transform.position;
            explosion.PlayAll(dieExplosionSoundFx);
        }
    }
    public void Explode()
    {
        EnemyExplosionController explosion = rsc.poolMng.enemyExplosionPool.GetObject();

        if (explosion != null)
        {
            explosion.transform.position = transform.position;
            explosion.PlayAll(finalExplosionSoundFx);
        }

        rsc.rumbleMng.Rumble(0, 0.3f, 0.5f, 0.5f);
        rsc.camerasMng.PlayEffect(0, 0.3f, 0.2f);
        voxelization.SpawnVoxels();
        //Destroy(gameObject);
        gameObject.SetActive(false);
    }