示例#1
0
    public void Kill()
    {
        GUIManager.ChangeGameState(GUIManager.GUI.GAME_OVER);
        Destroy(gameObject);
        GUILife.Kill();

        for (int i = 0; i < 20; i++)
        {
            Transform p = Instantiate(particle);
            p.transform.position = transform.position;
            p.GetComponent <ParticleHandler>().direction = Mathf.Atan2((transform.position - transform.position).y, (transform.position - transform.position).x) * Mathf.Rad2Deg + (i / 20f * 360f);
        }

        Transform s = Instantiate(sound, transform.position, transform.rotation);

        s.GetComponent <AudioSource>().clip = explosion;
        s.GetComponent <AudioSource>().Play();
    }