I have these buttons created in unity- 27 by 27 which has 9 by 9 subgrids Each button is 10 by 15 pixels. I want to get the coordinates of the centre of each subgrid(which has no grouping) which are numbered 1 to 9. There must be a neater way than coding
Code:
private int _num
private int devy
private int devx
private float _Xcood
private float _Ycood
if (_num==1 OR _num==2 OR _num==3)
{ devy =1}
else if (_num==4 OR _num==5 OR _num==6)
{devy=0}
else if (_num==7 OR _num==8 OR _num==9)
{devy=-1}
if (_num==3 OR _num==6 OR _num==9)
{ devx =1}
else if (_num==2 OR _num==5 OR _num==8)
{devx=0}
else if (_num==1 OR _num==4 OR _num==7)
{devx=-1}
_Xcood=devx*10+position.y
_Ycood=dexv*15+position.x