Ejemplo n.º 1
0
    public override void Break()
    {
        base.Break();

        broken = true;
        angle  = Random.Range(30, 60);
        if (Random.Range(0, 10) > 5)
        {
            angle = -angle;
        }
        speedX = SCR_Helper.Sin(angle) * BROKEN_SPEED;
        speedY = SCR_Helper.Cos(angle) * BROKEN_SPEED;

        smokeParticle.SetActive(true);
        transform.localEulerAngles = new Vector3(0, 0, angle);

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

        if (SCR_Profile.soundOn == 1)
        {
            GetComponent <AudioSource>().Stop();
        }
        SCR_Audio.PlayObjectHitSound();
        SCR_Audio.PlayDroneCollisionSound();
    }