public void SetTileToCell(GameObject obj, Vector3 v3, Cell cell) { if (obj != null) { //lastCell = cell; //v3 = grid.CellGetPosition(index); // GameObject instance = Instantiate(obj); properities = instance.GetComponent <CellProperities>(); properities.SetTileToDataCollection(cell); //properities.cell //properities.SetToCellInfo(lastCell); properitiesList.AddNewDataToList(properities); instance.transform.localPosition = v3; obj = null; //grid.CellSetTexture(grid.CellGetIndex(lastCell),tex2D); //tex2D = null; } else { Debug.Log("Need to assign texture to variable first!"); } }
//Once LMB pressed, check texture if it is null and assign it to cell public void SetTileToCell(/*Texture2D tex*/ GameObject obj) { if (obj != null) { lastCell = grid.cellHighlighted; v3 = grid.CellGetPosition(grid.CellGetIndex(lastCell)); //grid.CellSetSprite(grid.CellGetIndex(lastCell),Color.white,collection.spriteCollection[0]); // GameObject instance = Instantiate(obj); properities = instance.GetComponent <CellProperities>(); properities.SetTileToDataCollection(lastCell); //properities.SetToCellInfo(lastCell); properitiesList.AddNewDataToList(properities); instance.transform.localPosition = v3; obj = null; //grid.CellSetTexture(grid.CellGetIndex(lastCell),tex2D); //tex2D = null; } else { Debug.Log("Need to assign texture to variable first!"); } }
public void AddNewDataToList(CellProperities properities) { properitiesList.Add(properities); }