예제 #1
0
    IEnumerator Die()
    {
        canChangeColor        = false;
        this.gameObject.layer = 15;
        foreach (Transform child in transform)
        {
            child.gameObject.layer = 15;
        }
        //Destroy(myCas.GetComponent<Dragable>());
        dragger.MakeUndraggable();
        tr.enabled = false;
        yield return(new WaitForSeconds(1));

        Color casColor;

        for (int i = 0; i < 200; i++)
        {
            casColor = GetComponent <SpriteRenderer>().color;
            sp.color = new Color(casColor.r, casColor.g, casColor.b, casColor.a - 0.005f);
            yield return(new WaitForSeconds(0.01f));
        }
        sp.enabled = false;
        DNAType    = 0;
        yield return(new WaitForSeconds(1f));

        dragger.MakeDraggable();
        sp.enabled = true;
        sp.color   = new Color(oriColor.r, oriColor.g, oriColor.b, 1);
        //dragger.enabled = true;
        int xPos = Random.Range(-3, 3);

        transform.position = new Vector3(xPos, -4f, 0f);
        DNAType            = 0;
        canChangeColor     = true;
        canKill            = true;
        yield return(null);

        this.gameObject.layer = 9;
        foreach (Transform child in transform)
        {
            child.gameObject.layer = 9;
        }
    }