protected virtual void RandMove() { Vector2Int randGrid = new Vector2Int(); List <int> indexs = new List <int>() { 0, 1, 2, 3 }; int index = -1; do { if (index >= 0) { indexs.RemoveAt(index); } if (indexs.Count <= 0) { break; } index = Random.Range(0, indexs.Count); randGrid = CurGrid + MapHelper.NeighborGrids[indexs[index]]; } while (!CheckGridMovable(randGrid)); if (randGrid.x != 0 && randGrid.y != 0) { MoveToGrid(randGrid); } else { Agent.DoIdle(); var sequence = DOTween.Sequence(); sequence.AppendInterval(1); sequence.AppendCallback(OnMoveToGridFinish); } }