码迷,mamicode.com
首页 > 其他好文 > 详细

Radar之获取排列的UITexture数组

时间:2014-05-16 01:17:09      阅读:316      评论:0      收藏:0      [点我收藏+]

标签:style   blog   class   code   c   java   

1.定义UITexture二维数组

1
public UITexture[,] m_UITexture;

2.在 void start() 中分配内存

m_UITexture = new UITexture[30, 50];

3.遍历排列的UITexture

bubuko.com,布布扣
//用UITexture数组获取UITexture
    void GetUITexture()
    {
        Transform obj = GameObject.Find("Texture").transform;
        for (int i = 0; i < 5; i++)
        {
            for (int j = 0; j < 5; j++)
            {
                for (int k = 0; k < 6; k++)
                {
                    GetTransform(obj.GetChild(i).GetChild(j).GetChild(k), i, j, k);
                }
            }
        }
    }
bubuko.com,布布扣

4.用数组存储UITexture

bubuko.com,布布扣
Transform GetTransform(Transform check, int i, int j, int k)
    {
        int m = -2;
        foreach (Transform t in check.GetComponentsInChildren<Transform>())
        {
            m++;
            if (m >= 0)
            {
                m_UITexture[i * 6 + k, j * 10 + m] = t.gameObject.GetComponent<UITexture>();
            }
        }
        return null;
    }
bubuko.com,布布扣

 

Radar之获取排列的UITexture数组,布布扣,bubuko.com

Radar之获取排列的UITexture数组

标签:style   blog   class   code   c   java   

原文地址:http://www.cnblogs.com/felove2013/p/3730088.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!