Example #1
0
    private void Crash()
    {
        for (int i = 0; i < sprFragment.Length; i++)
        {
            GameObject frag = SCR_Pool.GetFreeObject(PFB_Fragment);
            frag.GetComponent <SCR_Fragment>().Spawn(x, y, sprFragment[i], 100, UFO_SCALE);
        }

        gameObject.SetActive(false);
        SCR_Gameplay.instance.flyingObject = null;

        smokeParticle.SetActive(false);
        crashParticle.transform.position = new Vector3(SCR_Gameplay.SCREEN_W * 0.5f + x, y, crashParticle.transform.position.z);
        foreach (Transform child in crashParticle.transform)
        {
            child.gameObject.SetActive(true);
        }

        broken                     = false;
        brokenCountdown            = 0;
        angle                      = 0;
        transform.localEulerAngles = new Vector3(0, 0, angle);

        SCR_Gameplay.instance.ShakeCamera(0.3f);
        SCR_Gameplay.instance.FlashWhite();
        SCR_Audio.PlayUFOExplosionSound();
    }