public void endMovement() { var unit = UnitPlacement [selectUnitX, selectUnitY]; if (unit != null) { GameUnit unitStat = (GameUnit)unit.GetComponent("GameUnit"); if (targetTileX != selectUnitX || targetTileY != selectUnitY) { TileSelect tileOld = PlayMap.Grid.getTileSpec(selectUnitX, selectUnitY); tileOld.resetCapture(); UnitPlacement [targetTileX, targetTileY] = UnitPlacement [selectUnitX, selectUnitY]; UnitPlacement [selectUnitX, selectUnitY] = null; unitStat.x = targetTileX; unitStat.y = targetTileY; } unitStat.ConfirmMovement(); } //Resets selection targetTileX = selectUnitX = selectTileX = -1; targetTileY = selectUnitY = selectTileY = -1; UnitMovementController.fullclear(); PlayMap.LockMovement = false; PlayMap.UnitMenu.SetActive(false); PlayMap.HideAttackInfo(); }