Пример #1
0
        public void CycleTextures()
        {
            _textureType = AnimationData.CycleTextureType(_textureType);

            frontPanel.SetTexture(_textureType);
            backPanel.SetTexture(_textureType);
            leftPanel.SetTexture(_textureType);
            rightPanel.SetTexture(_textureType);
            upPanel.SetTexture(_textureType);
            downPanel.SetTexture(_textureType);
        }
Пример #2
0
        public void CycleTextures()
        {
            _textureType = AnimationData.CycleTextureType(_textureType);

            GameObject cubeletFaceUp, cubeletFaceDown, cubeletFaceFront, cubeletFaceBack, cubeletFaceLeft, cubeletFaceRight;
            Texture    textureUp, textureDown, textureFront, textureBack, textureLeft, textureRight;

            if (_textureType == TextureType.plain)
            {
                textureUp    = texturePlain;
                textureDown  = texturePlain;
                textureFront = texturePlain;
                textureBack  = texturePlain;
                textureLeft  = texturePlain;
                textureRight = texturePlain;
            }
            else // if (_textureType == TextureType.none)
            {
                textureUp    = null;
                textureDown  = null;
                textureFront = null;
                textureBack  = null;
                textureLeft  = null;
                textureRight = null;
            }

            for (int x = 0; x < 5; x++)
            {
                for (int y = 0; y < 5; y++)
                {
                    for (int z = 0; z < 5; z++)
                    {
                        if (IsOuterCubelet(x, y, z))
                        {
                            CubeletData cData = _cubeletData[x, y, z];

                            cubeletFaceUp    = cData.cubelet.transform.GetChild(0).gameObject;
                            cubeletFaceDown  = cData.cubelet.transform.GetChild(1).gameObject;
                            cubeletFaceFront = cData.cubelet.transform.GetChild(2).gameObject;
                            cubeletFaceBack  = cData.cubelet.transform.GetChild(3).gameObject;
                            cubeletFaceLeft  = cData.cubelet.transform.GetChild(4).gameObject;
                            cubeletFaceRight = cData.cubelet.transform.GetChild(5).gameObject;

                            if (_textureType == TextureType.number)
                            {
                                textureUp    = cData.textureNumberUp;
                                textureDown  = cData.textureNumberDown;
                                textureFront = cData.textureNumberFront;
                                textureBack  = cData.textureNumberBack;
                                textureLeft  = cData.textureNumberLeft;
                                textureRight = cData.textureNumberRight;
                            }

                            cubeletFaceUp.GetComponent <MeshRenderer>().materials[0].mainTexture    = textureUp;
                            cubeletFaceDown.GetComponent <MeshRenderer>().materials[0].mainTexture  = textureDown;
                            cubeletFaceFront.GetComponent <MeshRenderer>().materials[0].mainTexture = textureFront;
                            cubeletFaceBack.GetComponent <MeshRenderer>().materials[0].mainTexture  = textureBack;
                            cubeletFaceLeft.GetComponent <MeshRenderer>().materials[0].mainTexture  = textureLeft;
                            cubeletFaceRight.GetComponent <MeshRenderer>().materials[0].mainTexture = textureRight;
                        }
                    }
                }
            }
        }