void StateMoveNeedToDo() { if (canMoveList.Count == 0) { UpdateIndex(); canMoveList.Add(index); FindCanMovePoints(Mathf.Clamp(ProcessedData.Instance.move, 0, 5), index); canMoveList.Remove(index); if (canMoveList.Count == 0) { ProcessedData.Instance.move = 0; } ChangeGridColor(canMoveList, Color.green); uiState.ChangeState("移動選択"); } else { if (Input.GetMouseButton(0) && !clickOnce) { clickOnce = true; var hit = Physics2D.Raycast(new Vector2(Camera.main.ScreenToWorldPoint(Input.mousePosition).x, Camera.main.ScreenToWorldPoint(Input.mousePosition).y), Vector2.zero, 0f); MapNodePiece piece = null; if (hit.transform != null) { piece = hit.transform.GetComponent <MapNodePiece>(); } else { return; } if (piece == null) { return; } if (!Map.Instance.isContainPointInPointList(canMoveList, piece.index)) { return; } moveList.Clear(); FindTheWay(Mathf.Clamp(ProcessedData.Instance.move, 0, 5), index, piece.index); FindTheLowestPath(); Move(moveList, 0); ResetGridColor(canMoveList); moveListList.Clear(); canMoveList.Clear(); } else if (!Input.GetMouseButton(0) && clickOnce) { clickOnce = false; } } }