bool IsCollide(BlockTeam bt, BT_Move_Type eBTMove = BT_Move_Type.BTM_None) { if (bt == null) { return(true); } Vector2Int vPos = bt.GetPos(); int iX = vPos.x; int iY = vPos.y; switch (eBTMove) { case BT_Move_Type.BTM_Left: iX = vPos.x - 1; break; case BT_Move_Type.BTM_Right: iX = vPos.x + 1; break; case BT_Move_Type.BTM_Down: iY = vPos.y + 1; break; default: break; } for (int i = 0; i < bt.GetWidth(); i++) { for (int j = 0; j < bt.GetHeight(); j++) { int iBTValue, iWallValue; if (bt.GetValue(i, j, out iBTValue)) { if (iBTValue != 0) { if (GetValue(i + iX, j + iY, out iWallValue)) { if (iWallValue != 0) { return(true); } } else { return(true); } } } else { return(true); } } } return(false); }
public bool GetBlockColor(int iX, int iY, out BlockColor blockColor) { blockColor = BlockColor.None; int iValue = 0; if (GetValue(iX, iY, out iValue)) { if (iValue != 0) { blockColor = BlockColor.Gray; } else { if (m_DropDownBT != null) { int iBTX = iX - m_DropDownBT.GetPos().x; int iBTY = iY - m_DropDownBT.GetPos().y; if (m_DropDownBT.GetValue(iBTX, iBTY, out iValue)) { if (iValue != 0) { blockColor = BlockColor.Yellow; } } } if (m_CurBlockTeam != null) { int iBTX = iX - m_CurBlockTeam.GetPos().x; int iBTY = iY - m_CurBlockTeam.GetPos().y; if (m_CurBlockTeam.GetValue(iBTX, iBTY, out iValue)) { if (iValue != 0) { blockColor = BlockColor.Red; } } } } return(true); } else { return(false); } }
void Merge(BlockTeam bt) { Vector2Int vPos = bt.GetPos(); for (int i = 0; i < bt.GetWidth(); i++) { for (int j = 0; j < bt.GetHeight(); j++) { int iBTValue; if (bt.GetValue(i, j, out iBTValue)) { if (iBTValue == 1) { SetValue(i + vPos.x, j + vPos.y, iBTValue); } } } } }