private void CreatePathCommand() { if (selected == null) { return; } int minGroupPointer = 30; int minGroupLenght = 1; int minSinglePointer = 10; Vector3 startPoint = selected.transform.position; bool isMin = mousePath.Count > minGroupPointer || UnityExtension.SumPath(mousePath) > minGroupLenght; ImprovePath(); if (selectedGroup.Count > 1 && isMin) { for (int i = 0; i < selectedGroup.Count; i++) { if (selectedGroup[i] == null) { continue; } Vector3 offset = selectedGroup[i].transform.position - startPoint; List <Vector3> gPath = new List <Vector3>(mousePath); for (int g = 0; g < gPath.Count; g++) { gPath[g] += offset; } selectedGroup[i].SetPathCommand(gPath); } } else if (mousePath.Count > minSinglePointer) { selected.SetPathCommand(mousePath); } selectedGroup.Clear(); selected = null; mousePath = new List <Vector3>(); }