前言
在计算组合块边框范围的时候想计算出四边的padding结果有问题,以后再想
private void CalcPadding(ComPieceData comPieceData
)
{
int[] padding
= new int[4];
int top
= comPieceData
.height
- comPieceData
.centerY
;
int right
= comPieceData
.width
- comPieceData
.centerX
;
int down
= comPieceData
.centerY
;
int left
= comPieceData
.centerX
;
padding
[0] = top
;
padding
[1] = right
;
padding
[2] = down
;
padding
[3] = left
;
comPieceData
.padding
= padding
;
}
public int Iteration()
{
rotateByIte
%= 4;
return comPieceData
.padding
[rotateByIte
++];
}
private bool IsFir
= true;
public void CalClpRge()
{
public int Iteration()
{
rotateByIte
%= 4;
return comPieceData
.padding
[rotateByIte
++];
}
private bool IsFir
= true;
public void CalClpRge()
{
if (!IsFir
)
{
rotateCpy
--;
if (rotateCpy
< 0) rotateCpy
= 3;
rotateByIte
= rotateCpy
;
}
IsFir
= false;
int[] padding
= new int[4];
int top
= comPieceData
.height
- comPieceData
.centerY
;
int right
= comPieceData
.width
- comPieceData
.centerX
;
int down
= comPieceData
.centerY
;
int left
= comPieceData
.centerX
;
maxY
= height
- top
;
maxX
= width
- right
;
minX
= left
- 1;
minY
= down
- 1;
maxY
= height
- top
;
maxX
= width
- right
;
minX
= left
;
minY
= down
;
Debug
.Log($
"{maxY}-{minY}-{maxX}-{minX}");
}
转载请注明原文地址: https://mac.8miu.com/read-501762.html