public bool CanDrop(int angleState, int[] indexPosition) { if (angleState == 1)//縦長 { if (gameManagerScript.stageArray[indexPosition[0] + 4, indexPosition[1]] == 1) { return(false); } int[,] fromArgument = { { indexPosition[0], indexPosition[1] } }; int[,] toArgument = { { indexPosition[0] + 4, indexPosition[1] } }; gameManagerScript.ChangeStatus(toArgument, fromArgument); } if (angleState == 2)//横長 { for (int i = 0; i < 4; i++) { if (gameManagerScript.stageArray[indexPosition[0] + 1, indexPosition[1] + i] == 1) { return(false); } } for (int i = 0; i < 4; i++) { int[,] fromArgument = { { indexPosition[0], indexPosition[1] + i } }; int[,] toArgument = { { indexPosition[0] + 1, indexPosition[1] + i } }; gameManagerScript.ChangeStatus(toArgument, fromArgument); } } return(true); }
public bool CanDrop(int angleState, int[] basePos) { if (gameManagerScript.stageArray[basePos[0] + 2, basePos[1]] == 1 || gameManagerScript.stageArray[basePos[0] + 2, basePos[1] + 1] == 1) { return(false); } int[,] toArgument = { { basePos[0] + 2, basePos[1] }, { basePos[0] + 2, basePos[1] + 1 } }; int[,] fromArgument = { { basePos[0], basePos[1] }, { basePos[0], basePos[1] + 1 } }; gameManagerScript.ChangeStatus(toArgument, fromArgument); return(true); }
public bool CanDrop(int angleState, int[] basePos) { if (angleState == 1)//L型 { Debug.Log((basePos[0] + 3).ToString() + basePos[1].ToString()); if (gameManagerScript.stageArray[basePos[0] + 3, basePos[1]] == 1 || gameManagerScript.stageArray[basePos[0] + 3, basePos[1] + 1] == 1) { return(false); } int[,] fromArgument = { { basePos[0], basePos[1] }, { basePos[0] + 2, basePos[1] + 1 } }; int[,] toArgument = { { basePos[0] + 3, basePos[1] }, { basePos[0] + 3, basePos[1] + 1 } }; gameManagerScript.ChangeStatus(toArgument, fromArgument); } if (angleState == 2)//右90度 { if (gameManagerScript.stageArray[basePos[0] + 1, basePos[1]] == 1 || gameManagerScript.stageArray[basePos[0] + 1, basePos[1] - 1] == 1 || gameManagerScript.stageArray[basePos[0] + 2, basePos[1] - 2] == 1) { return(false); } int[,] fromArgument = { { basePos[0], basePos[1] }, { basePos[0], basePos[1] - 1 }, { basePos[0], basePos[1] - 2 }, }; int[,] toArgument = { { basePos[0] + 1, basePos[1] }, { basePos[0] + 1, basePos[1] - 1 }, { basePos[0] + 2, basePos[1] - 2 } }; gameManagerScript.ChangeStatus(toArgument, fromArgument); } return(true); }