Ejemplo n.º 1
0
    private IEnumerator Explode()
    {
        yield return(new WaitForSeconds(1.0f));

        isExploded = true;
        soundFX.BuildingExplode();
        ExplosionPf.SetActive(true);

        foreach (var unit in victims)
        {
            if (unit != null)
            {
                unit.GetComponent <FighterController> ().life -= 100;

                if (unit.GetComponent <FighterController> ().life <= 0)
                {
                    Vector3 pos = unit.transform.position;

                    Instantiate(Vortex, new Vector3(pos.x, pos.y, explosionZ), Quaternion.identity);
                    Instantiate(Grave, new Vector3(pos.x, pos.y, zeroZ), Quaternion.identity);
                    Instantiate(Ghost, new Vector3(pos.x, pos.y, ghostZ), Quaternion.identity);

                    ((Helios)helios).KillUnit(unit.GetComponent <FighterController> ().assignedToGroup,
                                              unit.GetComponent <Selector> ().index);
                    unit.GetComponent <FighterController> ().Hit();
                }
            }
        }
        victims.Clear();

        //StartCoroutine ("DestroySelf");
    }