positionList = new List();
// Use this for initialization
void Start () {
InitMap();
}
// Update is called once per frame
void Update () {
}
private void InitMap()
{
mapHolder = new GameObject("Map").transform;// 设置一个父类管理生成的地图
for(int x = 0; x < cols; x++)
{
for(int y= 0; y < rows; y++)
{
if(x==0 ||y==0 || x == cols - 1 || y == rows - 1)//地图最外面一圈是围墙
{
int index = Random.Range(0, OutWallArray.Length);
GameObject go = GameObject.Instantiate(OutWallArray[index], new Vector3(x, y, 0), Quaternion.identity) as GameObject;
go.transform.SetParent(mapHolder);
}
else// 其余是地板
{
int index = Random.Range(0, FloorArray