void CheckLocationState() { locationX = warCtrl.GetLocationPositionX(transform.localPosition.x); locationY = warCtrl.GetLocationPositionY(transform.localPosition.y); SetMapLocation(); if (state == State.Magic || WarSceneController.state == WarSceneController.State.Dead || WarSceneController.state == WarSceneController.State.End) { return; } isStopped = false; bool flag = false; if (Random.Range(0, 100) > 50) { flag = true; for (int i = locationX + 1; i <= locationX + (int)(hitDistance / locationStepX); i++) { if (i >= manPosMaxX * 2 / locationStepX) { continue; } if (warCtrl.GetLocationFlag(i, locationY) != 0) { if (side == WarSceneController.WhichSide.Left) { if (warCtrl.GetLocationSide(i, locationY) == side) { if (state != State.Escape && i == locationX + 1) { isStopped = true; } } else { if (state != State.Escape) { SetAttackFront(); } break; } } else { if (warCtrl.GetLocationSide(i, locationY) != side) { if (state != State.Escape) { SetAttackBack(); } else { SetAttackFront(); } } else { if (state == State.Escape && i == locationX + 1) { isStopped = true; } } } } } } if (isFighting) { return; } for (int i = locationX - (int)(hitDistance / locationStepX); i < locationX; i++) { if (i <= 0) { continue; } if (warCtrl.GetLocationFlag(i, locationY) != 0) { if (side == WarSceneController.WhichSide.Right) { if (warCtrl.GetLocationSide(i, locationY) == side) { if (state != State.Escape && i == locationX - 1) { isStopped = true; } } else { if (state != State.Escape) { SetAttackFront(); } break; } } else { if (warCtrl.GetLocationSide(i, locationY) != side) { if (state != State.Escape) { SetAttackBack(); } else { SetAttackFront(); } } else { if (state == State.Escape && i == locationX - 1) { isStopped = true; } } } } } if (isFighting) { return; } if (!flag) { for (int i = locationX + 1; i <= locationX + (int)(hitDistance / locationStepX); i++) { if (i >= manPosMaxX * 2 / locationStepX) { continue; } if (warCtrl.GetLocationFlag(i, locationY) != 0) { if (side == WarSceneController.WhichSide.Left) { if (warCtrl.GetLocationSide(i, locationY) == side) { if (state != State.Escape && i == locationX + 1) { isStopped = true; } } else { if (state != State.Escape) { SetAttackFront(); } break; } } else { if (warCtrl.GetLocationSide(i, locationY) != side) { if (state != State.Escape) { SetAttackBack(); } else { SetAttackFront(); } } else { if (state == State.Escape && i == locationX + 1) { isStopped = true; } } } } } } }