// Give a unitgroup a hex to move to and it should issue orders to all of its sub-units to move there // after checking if the move is possible // TODO - More sophisticated checking if a move is valid public bool MoveTo(Vector3Int destinationHex) { // Check if the destination is within the UnitGroup's speed if (Hex.Distance(curPosition, destinationHex) <= this.Speed) { // Set new current hex and move all sub-units to the new hex // TODO - for now, the code works for one unit only. This function will need to tell each unit where to go so it looks nice in the hex. HightlightCurrentHex(Color.white); HighlightMovementRange(Color.white); curPosition = destinationHex; this.transform.position = HexConversions.CubeCoordToWorldPosition(destinationHex); List <Vector3> unitPositions = getUnitPositions(units.Count); for (int i = 0; i < units.Count; ++i) { units[i].MoveTo(this.transform.position + unitPositions[i]); } return(true); } else { Debug.Log("Squad attempted to move to a position outside of its range of movement"); return(false); } }