예제 #1
0
 /// <summary>
 /// cube画像の初期設定
 /// </summary>
 private void InitializeCubeTexture()
 {
     m_obj.GetComponent <SelectCube>().SetInitTexture(m_texture);
     m_backFace       = SelectCube.Face.BACK;
     m_leftFace       = SelectCube.Face.LEFT;
     m_backTextureNum = (int)m_backFace;
     m_leftTextureNum = (int)m_leftFace;
 }
예제 #2
0
        /// <summary>
        /// テクスチャの変更
        /// </summary>
        /// <param name="dir"></param>
        private void RotateTexture(bool dir)
        {
            if (dir)
            {// 右移動
                // Leftが正面の時は左にする
                if (m_leftFace == SelectCube.Face.LEFT)
                {
                    m_leftFace = SelectCube.Face.FRONT;
                }
                else
                {
                    m_leftFace++;    // その他はマイナス
                }
                if (m_backFace == SelectCube.Face.LEFT)
                {
                    m_backFace = SelectCube.Face.FRONT;
                }
                else
                {
                    m_backFace++;
                }

                // 画像番号処理
                m_selectScene++;
                if (m_selectScene > m_texture.Length - 1)
                {
                    m_selectScene = 0;
                }
                m_backTextureNum = m_selectScene + 2;

                if (m_selectScene == m_texture.Length - 2)
                {
                    m_backTextureNum = 0;
                }
                else if (m_selectScene == m_texture.Length - 1)
                {
                    m_backTextureNum = 1;
                }

                // 背面の画像を変更
                if (m_backTextureNum >= 0 && m_backTextureNum < m_texture.Length)
                {
                    m_obj.GetComponent <SelectCube>().ChangeTexture(m_backFace, m_texture[m_backTextureNum]);
                }
            }
            else
            {// 左移動
                // frontの時は一周回ったことになりleftへ
                if (m_leftFace == SelectCube.Face.FRONT)
                {
                    m_leftFace = SelectCube.Face.LEFT;
                }
                else
                {
                    m_leftFace--;
                }
                if (m_backFace == SelectCube.Face.FRONT)
                {
                    m_backFace = SelectCube.Face.LEFT;
                }
                else
                {
                    m_backFace--;
                }

                // 番号処理
                m_selectScene--;
                if (m_selectScene < 0)
                {
                    m_selectScene = m_texture.Length - 1;
                }
                m_leftTextureNum = m_selectScene - 1;

                if (m_selectScene == 0)
                {
                    m_leftTextureNum = m_texture.Length - 1;
                }

                // 左面の画像を変更
                if (m_leftTextureNum >= 0 && m_leftTextureNum < m_texture.Length)
                {
                    m_obj.GetComponent <SelectCube>().ChangeTexture(m_leftFace, m_texture[m_leftTextureNum]);
                }
            }
            m_saveScene = m_selectScene;
        }