public void LoadGrid(CellData _cell, float XposMod, float ZPosMod) { GameObject tempCell = Instantiate(Cell3DPrefab, transform); Transform tempCellTransform = tempCell.GetComponent <Transform>(); tempCell.SetActive(true); tempCellTransform.localScale = new Vector3((tempCellTransform.lossyScale.x / tempCellTransform.localScale.x) * XMod, 0.1f, (tempCellTransform.lossyScale.z / tempCellTransform.localScale.z) * ZMod); //tempCellTransform.position = _cell.Position; tempCellTransform.position = new Vector3((gridOrigin.x + XMod / 2) + XMod * XposMod, 0, (gridOrigin.z + ZMod / 2) + +ZMod * ZPosMod); Cell3D cellvalue = tempCell.GetComponent <Cell3D>(); cellvalue.data = _cell; cellvalue.data.graphics3D = tempCell; cellvalue.UpdateTypes(); }
public void Load3DGrid(CellData _cell, float XposMod, float ZPosMod) { GameObject tempCell = Instantiate(Cell3DPrefab, transform); Transform tempCellTransform = tempCell.GetComponent <Transform>(); tempCell.SetActive(true); tempCellTransform.localScale = new Vector3((tempCellTransform.lossyScale.x / tempCellTransform.localScale.x) * XMod3D, 0.1f, (tempCellTransform.lossyScale.z / tempCellTransform.localScale.z) * ZMod3D); tempCellTransform.position = new Vector3((gridOrigin.x + XMod3D / 2) + XMod3D * XposMod, 0, (gridOrigin.z + ZMod3D / 2) + +ZMod3D * ZPosMod); Cell3D cellvalue = tempCell.GetComponent <Cell3D>(); cellvalue.data = _cell; cellvalue.data.graphics3D = tempCell; cellvalue.GetComponent <MeshRenderer>().enabled = false; cellvalue.NotInEditor = true; cellvalue.UpdateTypes(); }