Exemple #1
0
    public void SetType(CubeType cubeType)
    {
        this.type     = cubeType;
        this.material = cubeManager.GetMaterial(cubeType);

        if (cubeType == CubeType.Glass)
        {
            //this.gameObject.GetComponent<MeshRenderer>().enabled = false;
            for (int i = 0; i < this.gameObject.transform.childCount; i++)
            {
                this.transform.GetChild(i).gameObject.SetActive(true);
            }
            foreach (MegaCacheOBJRef objRef in this.transform.GetComponentsInChildren <MegaCacheOBJRef>())
            {
                objRef.animate = false;
            }
        }



        Renderer renderer = GetComponent <Renderer>();

        if (renderer != null)
        {
            renderer.material = this.material;
        }
        gameObject.GetComponent <Rigidbody>().mass = 1;
    }