예제 #1
0
    void CreateCell(uint x, uint z, uint i) //创建单元格
    {
        Vector3 position;

        position.x = x * 10f;
        position.y = Ground.transform.localPosition.y;
        position.z = z * 10f;
        CubeCell Cell = CubeCells[i] = Instantiate <CubeCell>(CubePrefab);

        Cell.SetPosition(x, z);
        Cell.transform.SetParent(transform, false);
        Cell.transform.localPosition = position + Offset;
        Cell.name = "CubeCell (" + x.ToString() + "," + z.ToString() + ")";
    }
예제 #2
0
    //private void Update()
    //{
    //    //for(int i=0;i<RowCounter.Count;i++)
    //    //    Debug.Log(string.Format("第{0}行单位数:{1}", i,RowCounter[i]));
    //}
    void CreateCell(int x, int z, int i) //创建单元格
    {
        Vector3 position;

        position.x = x * Distance;
        position.y = Ground.transform.localPosition.y;
        position.z = z * Distance;
        CubeCell Cell = Instantiate <CubeCell>(CubePrefab);

        CubeCells.Add(Cell);
        Cell.SetPosition(x, z);
        Cell.transform.SetParent(transform, false);
        Cell.transform.localPosition = position + Offset;
        Cell.name = string.Format("CubeCell({0},{1})", x, z);
        Cell.gameObject.SetActive(false);
    }