Exemplo n.º 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);
    }
Exemplo n.º 3
0
 public void SpawnVoxels()
 {
     if (blackboard.lastShotSameColor)
     {
         voxelization.SetMaterial(color);
         voxelization.SpawnFakeVoxels();
     }
     else
     {
         voxelization.SetGreyMaterial();
         //Wrong color does not explode so, grid has to be more precise
         voxelization.CalculateVoxelsGrid();
         voxelization.SpawnColliderThisTime = false;
         voxelization.SpawnVoxels();
     }
 }