
Untitled
By: a guest on
May 16th, 2012 | syntax:
None | size: 1.03 KB | hits: 15 | expires: Never
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public enum objectType { grass, road };
public class MakeGrid : MonoBehaviour {
public int gridWidth;
public int gridHeight;
public int space;
public GameObject roadObject;
public GameObject grassObject;
public List<Vector3> objectPosition;
public List<objectType> objectRefType;
public List<int> objectSlotType;
// Use this for initialization
void Start () {
objectPosition = new List<Vector3>();
objectRefType = new List<objectType>();
objectSlotType = new List<int>{ 10,11,12,14,15,16,19,21,23,25,27,28,30,31,32,34,43,46,47,48,49,50,52,55,59,61,64,65,66,68,69,70,75 };
CreateGrid();
}
void CreateGrid()
{
int topSpace;
int widthSpace;
for ( int x = 0; x < gridWidth; x++ )
{
for (int y = 0; y < gridHeight; y++ )
{
topSpace = (x * space );
widthSpace = ( y * space );
objectPosition.Add(new Vector3 (topSpace, widthSpace,0));
}
}
}
}