void Start() { grid = AG_Grid.Instance; transform.parent = grid.grid[posX, posY].transform; transform.localPosition = Vector3.zero; AG_Cell myCell = transform.parent.GetComponent <AG_Cell>(); Debug.Log(grid); posX = myCell.PosX; posY = myCell.PosY; }
void Awake() { Instance = this; int sayac = 0; for (int i = 0; i < 20; i++) { for (int j = 0; j < 20; j++) { grid[i, j] = (new GameObject()).AddComponent <SpriteRenderer>().gameObject.AddComponent <AG_Cell>(); grid[i, j].name = "[CELL]"; grid[i, j].transform.localScale = new Vector2(1, 1); grid[i, j].transform.position = new Vector2(i, j); grid[i, j].transform.parent = transform; grid[i, j]._setData(i, j); grid[i, j].GetComponent <SpriteRenderer>().sortingOrder = -1; createObject(selectedLevel.grid[sayac], i, j, grid[i, j].transform); sayac++; } } }
public void Start() { grid = AG_Grid.Instance; }