com.wallstop-studios.unity-helpers 2.0.0-rc73.6 → 2.0.0-rc73.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -140,7 +140,7 @@
140
140
  return;
141
141
  }
142
142
 
143
- absolutePath = absolutePath.Replace("\\", "/");
143
+ absolutePath = absolutePath.SanitizePath();
144
144
  if (absolutePath.StartsWith(Application.dataPath, StringComparison.OrdinalIgnoreCase))
145
145
  {
146
146
  string relativePath =
@@ -595,7 +595,7 @@
595
595
 
596
596
  string firstFramePath = AssetDatabase.GetAssetPath(validFrames[0]);
597
597
  string assetPath =
598
- Path.GetDirectoryName(firstFramePath)?.Replace("\\", "/") ?? "Assets";
598
+ Path.GetDirectoryName(firstFramePath).SanitizePath() ?? "Assets";
599
599
  if (!assetPath.EndsWith("/"))
600
600
  {
601
601
  assetPath += "/";
@@ -775,8 +775,7 @@
775
775
  }
776
776
 
777
777
  string assetPath = AssetDatabase.GetAssetPath(sprite);
778
- string directoryPath =
779
- Path.GetDirectoryName(assetPath)?.Replace("\\", "/") ?? "";
778
+ string directoryPath = Path.GetDirectoryName(assetPath).SanitizePath() ?? "";
780
779
  string frameName = sprite.name;
781
780
 
782
781
  int splitIndex = frameName.LastIndexOf('_');
@@ -336,6 +336,14 @@
336
336
  _ = updatedImporters.Remove(textureImporter);
337
337
  }
338
338
  }
339
+ }
340
+ finally
341
+ {
342
+ if (applyChanges)
343
+ {
344
+ AssetDatabase.StopAssetEditing();
345
+ }
346
+ EditorUtility.ClearProgressBar();
339
347
 
340
348
  if (applyChanges)
341
349
  {
@@ -356,14 +364,6 @@
356
364
  }
357
365
  }
358
366
  }
359
- finally
360
- {
361
- if (applyChanges)
362
- {
363
- AssetDatabase.StopAssetEditing();
364
- }
365
- EditorUtility.ClearProgressBar();
366
- }
367
367
  return changedCount;
368
368
  }
369
369
  }
@@ -213,11 +213,6 @@
213
213
  newImporters.Add(newImporter);
214
214
  }
215
215
  }
216
-
217
- foreach (TextureImporter newImporter in newImporters)
218
- {
219
- newImporter.SaveAndReimport();
220
- }
221
216
  }
222
217
  finally
223
218
  {
@@ -276,8 +271,10 @@
276
271
  return null;
277
272
  }
278
273
 
279
- TextureImporter importer = AssetImporter.GetAtPath(assetPath) as TextureImporter;
280
- if (importer is not { textureType: TextureImporterType.Sprite })
274
+ if (
275
+ AssetImporter.GetAtPath(assetPath)
276
+ is not TextureImporter { textureType: TextureImporterType.Sprite } importer
277
+ )
281
278
  {
282
279
  return null;
283
280
  }
@@ -285,7 +282,6 @@
285
282
  TextureImporterSettings originalSettings = new();
286
283
  importer.ReadTextureSettings(originalSettings);
287
284
 
288
- bool originalReadableState = importer.isReadable;
289
285
  if (!importer.isReadable)
290
286
  {
291
287
  importer.isReadable = true;
@@ -298,142 +294,128 @@
298
294
  return null;
299
295
  }
300
296
 
301
- TextureImporter resultImporter;
302
- try
303
- {
304
- Color32[] pixels = tex.GetPixels32();
305
-
306
- int width = tex.width;
307
- int height = tex.height;
308
- int minX = width;
309
- int minY = height;
310
- int maxX = 0;
311
- int maxY = 0;
312
- bool hasVisible = false;
313
-
314
- object lockObject = new();
315
-
316
- Parallel.For(
317
- 0,
318
- width * height,
319
- () => (minX: width, minY: height, maxX: 0, maxY: 0, hasVisible: false),
320
- (index, _, localState) =>
321
- {
322
- int x = index % width;
323
- int y = index / width;
297
+ Color32[] pixels = tex.GetPixels32();
298
+ int width = tex.width;
299
+ int height = tex.height;
300
+ int minX = width;
301
+ int minY = height;
302
+ int maxX = 0;
303
+ int maxY = 0;
304
+ bool hasVisible = false;
305
+
306
+ object lockObject = new();
307
+
308
+ Parallel.For(
309
+ 0,
310
+ width * height,
311
+ () => (minX: width, minY: height, maxX: 0, maxY: 0, hasVisible: false),
312
+ (index, _, localState) =>
313
+ {
314
+ int x = index % width;
315
+ int y = index / width;
324
316
 
325
- float a = pixels[index].a / 255f;
326
- if (a > AlphaThreshold)
327
- {
328
- localState.hasVisible = true;
329
- localState.minX = Mathf.Min(localState.minX, x);
330
- localState.minY = Mathf.Min(localState.minY, y);
331
- localState.maxX = Mathf.Max(localState.maxX, x);
332
- localState.maxY = Mathf.Max(localState.maxY, y);
333
- }
334
- return localState;
335
- },
336
- finalLocalState =>
317
+ float a = pixels[index].a / 255f;
318
+ if (a > AlphaThreshold)
337
319
  {
338
- if (finalLocalState.hasVisible)
339
- {
340
- lock (lockObject)
341
- {
342
- hasVisible = true;
343
- minX = Mathf.Min(minX, finalLocalState.minX);
344
- minY = Mathf.Min(minY, finalLocalState.minY);
345
- maxX = Mathf.Max(maxX, finalLocalState.maxX);
346
- maxY = Mathf.Max(maxY, finalLocalState.maxY);
347
- }
348
- }
320
+ localState.hasVisible = true;
321
+ localState.minX = Mathf.Min(localState.minX, x);
322
+ localState.minY = Mathf.Min(localState.minY, y);
323
+ localState.maxX = Mathf.Max(localState.maxX, x);
324
+ localState.maxY = Mathf.Max(localState.maxY, y);
349
325
  }
350
- );
351
-
352
- if (!hasVisible)
326
+ return localState;
327
+ },
328
+ finalLocalState =>
353
329
  {
354
- return null;
355
- }
356
-
357
- int cropWidth = maxX - minX + 1;
358
- int cropHeight = maxY - minY + 1;
359
-
360
- if (_onlyNecessary && cropWidth == width && cropHeight == height)
361
- {
362
- return null;
363
- }
364
-
365
- Texture2D cropped = new(cropWidth, cropHeight, TextureFormat.RGBA32, false);
366
- Color32[] croppedPixels = new Color32[cropWidth * cropHeight];
367
-
368
- Parallel.For(
369
- 0,
370
- cropHeight,
371
- y =>
330
+ if (finalLocalState.hasVisible)
372
331
  {
373
- int sourceYOffset = (y + minY) * width;
374
- int destYOffset = y * cropWidth;
375
- for (int x = 0; x < cropWidth; ++x)
332
+ lock (lockObject)
376
333
  {
377
- croppedPixels[destYOffset + x] = pixels[sourceYOffset + x + minX];
334
+ hasVisible = true;
335
+ minX = Mathf.Min(minX, finalLocalState.minX);
336
+ minY = Mathf.Min(minY, finalLocalState.minY);
337
+ maxX = Mathf.Max(maxX, finalLocalState.maxX);
338
+ maxY = Mathf.Max(maxY, finalLocalState.maxY);
378
339
  }
379
340
  }
380
- );
381
-
382
- cropped.SetPixels32(croppedPixels);
383
- cropped.Apply();
384
-
385
- string newPath = Path.Combine(
386
- assetDirectory,
387
- CroppedPrefix + Path.GetFileName(assetPath)
388
- );
389
- File.WriteAllBytes(newPath, cropped.EncodeToPNG());
390
- DestroyImmediate(cropped);
391
- AssetDatabase.ImportAsset(newPath);
392
- TextureImporter newImporter = AssetImporter.GetAtPath(newPath) as TextureImporter;
393
- if (newImporter == null)
394
- {
395
- return null;
396
341
  }
342
+ );
397
343
 
398
- newImporter.textureType = importer.textureType;
399
- newImporter.spriteImportMode = importer.spriteImportMode;
400
- newImporter.filterMode = importer.filterMode;
401
- newImporter.textureCompression = importer.textureCompression;
402
- newImporter.wrapMode = importer.wrapMode;
403
- newImporter.mipmapEnabled = importer.mipmapEnabled;
404
- newImporter.spritePixelsPerUnit = importer.spritePixelsPerUnit;
405
-
406
- TextureImporterSettings newSettings = new();
407
- newImporter.ReadTextureSettings(newSettings);
408
- newSettings.spriteExtrude = originalSettings.spriteExtrude;
409
-
410
- Vector2 origPivot = GetSpritePivot(importer);
411
- Vector2 origCenter = new(width * origPivot.x, height * origPivot.y);
412
- Vector2 newPivotPixels = origCenter - new Vector2(minX, minY);
413
- Vector2 newPivotNorm = new(
414
- cropWidth > 0 ? newPivotPixels.x / cropWidth : 0.5f,
415
- cropHeight > 0 ? newPivotPixels.y / cropHeight : 0.5f
416
- );
417
-
418
- newImporter.spriteImportMode = SpriteImportMode.Single;
419
- newImporter.spritePivot = newPivotNorm;
420
- newSettings.spritePivot = newPivotNorm;
421
- newSettings.spriteAlignment = (int)SpriteAlignment.Custom;
344
+ if (!hasVisible)
345
+ {
346
+ return null;
347
+ }
422
348
 
423
- newImporter.SetTextureSettings(newSettings);
424
- newImporter.isReadable = false;
349
+ int cropWidth = maxX - minX + 1;
350
+ int cropHeight = maxY - minY + 1;
425
351
 
426
- resultImporter = newImporter;
427
- }
428
- finally
352
+ if (_onlyNecessary && cropWidth == width && cropHeight == height)
429
353
  {
430
- if (importer != null && importer.isReadable != originalReadableState)
354
+ return null;
355
+ }
356
+
357
+ Texture2D cropped = new(cropWidth, cropHeight, TextureFormat.RGBA32, false);
358
+ Color32[] croppedPixels = new Color32[cropWidth * cropHeight];
359
+
360
+ Parallel.For(
361
+ 0,
362
+ cropHeight,
363
+ y =>
431
364
  {
432
- importer.isReadable = originalReadableState;
433
- importer.SaveAndReimport();
365
+ int sourceYOffset = (y + minY) * width;
366
+ int destYOffset = y * cropWidth;
367
+ for (int x = 0; x < cropWidth; ++x)
368
+ {
369
+ croppedPixels[destYOffset + x] = pixels[sourceYOffset + x + minX];
370
+ }
434
371
  }
372
+ );
373
+
374
+ cropped.SetPixels32(croppedPixels);
375
+ cropped.Apply();
376
+
377
+ string newPath = Path.Combine(
378
+ assetDirectory,
379
+ CroppedPrefix + Path.GetFileName(assetPath)
380
+ );
381
+ File.WriteAllBytes(newPath, cropped.EncodeToPNG());
382
+ DestroyImmediate(cropped);
383
+ AssetDatabase.ImportAsset(newPath);
384
+ TextureImporter newImporter = AssetImporter.GetAtPath(newPath) as TextureImporter;
385
+ if (newImporter == null)
386
+ {
387
+ return null;
435
388
  }
436
389
 
390
+ newImporter.textureType = importer.textureType;
391
+ newImporter.spriteImportMode = importer.spriteImportMode;
392
+ newImporter.filterMode = importer.filterMode;
393
+ newImporter.textureCompression = importer.textureCompression;
394
+ newImporter.wrapMode = importer.wrapMode;
395
+ newImporter.mipmapEnabled = importer.mipmapEnabled;
396
+ newImporter.spritePixelsPerUnit = importer.spritePixelsPerUnit;
397
+
398
+ TextureImporterSettings newSettings = new();
399
+ importer.ReadTextureSettings(newSettings);
400
+
401
+ Vector2 origPivot = GetSpritePivot(importer);
402
+ Vector2 origCenter = new(width * origPivot.x, height * origPivot.y);
403
+ Vector2 newPivotPixels = origCenter - new Vector2(minX, minY);
404
+ Vector2 newPivotNorm = new(
405
+ cropWidth > 0 ? newPivotPixels.x / cropWidth : 0.5f,
406
+ cropHeight > 0 ? newPivotPixels.y / cropHeight : 0.5f
407
+ );
408
+
409
+ newImporter.spriteImportMode = SpriteImportMode.Single;
410
+ newImporter.spritePivot = newPivotNorm;
411
+ newSettings.spritePivot = newPivotNorm;
412
+ newSettings.spriteAlignment = (int)SpriteAlignment.Custom;
413
+
414
+ newImporter.SetTextureSettings(newSettings);
415
+ newImporter.isReadable = true;
416
+ newImporter.SaveAndReimport();
417
+
418
+ TextureImporter resultImporter = newImporter;
437
419
  return resultImporter;
438
420
  }
439
421
 
@@ -34,7 +34,7 @@
34
34
  float yN = Math.Max(center.y, rectangle.y);
35
35
  float dX = xN - center.x;
36
36
  float dY = yN - center.y;
37
- return (dX * dX + dY * dY) <= _radiusSquared;
37
+ return dX * dX + dY * dY <= _radiusSquared;
38
38
  }
39
39
 
40
40
  public bool Overlaps(Bounds bounds)
@@ -45,7 +45,7 @@
45
45
 
46
46
  Bounds[] quadrants =
47
47
  {
48
- new Bounds(
48
+ new(
49
49
  new Vector3(
50
50
  boundary.center.x - halfQuadrantSize.x,
51
51
  boundary.center.y + halfQuadrantSize.y,
@@ -53,7 +53,7 @@
53
53
  ),
54
54
  quadrantSize
55
55
  ),
56
- new Bounds(
56
+ new(
57
57
  new Vector3(
58
58
  boundary.center.x + halfQuadrantSize.x,
59
59
  boundary.center.y + halfQuadrantSize.y,
@@ -61,7 +61,7 @@
61
61
  ),
62
62
  quadrantSize
63
63
  ),
64
- new Bounds(
64
+ new(
65
65
  new Vector3(
66
66
  boundary.center.x + halfQuadrantSize.x,
67
67
  boundary.center.y - halfQuadrantSize.y,
@@ -69,7 +69,7 @@
69
69
  ),
70
70
  quadrantSize
71
71
  ),
72
- new Bounds(
72
+ new(
73
73
  new Vector3(
74
74
  boundary.center.x - halfQuadrantSize.x,
75
75
  boundary.center.y - halfQuadrantSize.y,
@@ -534,14 +534,14 @@
534
534
  rgb.b > 0.04045 ? Mathf.Pow((rgb.b + 0.055f) / 1.055f, 2.4f) : rgb.b / 12.92f;
535
535
 
536
536
  double x = (r * 0.4124 + g * 0.3576 + b * 0.1805) / 0.95047;
537
- double y = (r * 0.2126 + g * 0.7152 + b * 0.0722);
537
+ double y = r * 0.2126 + g * 0.7152 + b * 0.0722;
538
538
  double z = (r * 0.0193 + g * 0.1192 + b * 0.9505) / 1.08883;
539
539
 
540
- x = x > 0.008856 ? Mathf.Pow((float)x, 1f / 3f) : (7.787 * x) + 16f / 116f;
541
- y = y > 0.008856 ? Mathf.Pow((float)y, 1f / 3f) : (7.787 * y) + 16f / 116f;
542
- z = z > 0.008856 ? Mathf.Pow((float)z, 1f / 3f) : (7.787 * z) + 16f / 116f;
540
+ x = x > 0.008856 ? Mathf.Pow((float)x, 1f / 3f) : 7.787 * x + 16f / 116f;
541
+ y = y > 0.008856 ? Mathf.Pow((float)y, 1f / 3f) : 7.787 * y + 16f / 116f;
542
+ z = z > 0.008856 ? Mathf.Pow((float)z, 1f / 3f) : 7.787 * z + 16f / 116f;
543
543
 
544
- return new LABColor((116 * y) - 16, 500 * (x - y), 200 * (y - z));
544
+ return new LABColor(116 * y - 16, 500 * (x - y), 200 * (y - z));
545
545
  }
546
546
 
547
547
  private static Color LABToRGB(double l, double a, double b)
@@ -78,7 +78,7 @@
78
78
 
79
79
  public static IEnumerable<IEnumerable<T>> Partition<T>(this IEnumerable<T> items, int size)
80
80
  {
81
- using var enumerator = items.GetEnumerator();
81
+ using IEnumerator<T> enumerator = items.GetEnumerator();
82
82
  bool hasNext = enumerator.MoveNext();
83
83
 
84
84
  IEnumerable<T> NextPartitionOf()
@@ -126,9 +126,9 @@
126
126
  xMin,
127
127
  yMin,
128
128
  zMin,
129
- (xMax - xMin) + 1,
130
- (yMax - yMin) + 1,
131
- (zMax - zMin) + 1
129
+ xMax - xMin + 1,
130
+ yMax - yMin + 1,
131
+ zMax - zMin + 1
132
132
  );
133
133
  }
134
134
 
@@ -160,9 +160,9 @@
160
160
  xMin,
161
161
  yMin,
162
162
  zMin,
163
- (xMax - xMin) + 1,
164
- (yMax - yMin) + 1,
165
- (zMax - zMin) + 1
163
+ xMax - xMin + 1,
164
+ yMax - yMin + 1,
165
+ zMax - zMin + 1
166
166
  );
167
167
  }
168
168
 
@@ -584,8 +584,8 @@
584
584
  public float LargestAngle(FastVector3Int point)
585
585
  {
586
586
  Vector2 worldPoint = _grid.CellToWorld(point);
587
- float angleFrom = Vector2.Angle((toWorld - fromWorld), (worldPoint - fromWorld));
588
- float angleTo = Vector2.Angle((fromWorld - toWorld), (worldPoint - toWorld));
587
+ float angleFrom = Vector2.Angle(toWorld - fromWorld, worldPoint - fromWorld);
588
+ float angleTo = Vector2.Angle(fromWorld - toWorld, worldPoint - toWorld);
589
589
  return Math.Max(angleFrom, angleTo);
590
590
  }
591
591
  }
@@ -1126,7 +1126,7 @@
1126
1126
  }
1127
1127
 
1128
1128
  if (
1129
- (newVector.x < position.x) == (position.x <= oldVector.x)
1129
+ newVector.x < position.x == position.x <= oldVector.x
1130
1130
  && (position.y - (long)lhs.y) * (rhs.x - lhs.x)
1131
1131
  < (rhs.y - (long)lhs.y) * (position.x - lhs.x)
1132
1132
  )
@@ -1274,7 +1274,7 @@
1274
1274
  yield break;
1275
1275
  }
1276
1276
 
1277
- scaleFactor *= (4 / 3f);
1277
+ scaleFactor *= 4 / 3f;
1278
1278
  }
1279
1279
  }
1280
1280
 
@@ -1416,8 +1416,8 @@
1416
1416
  float ty = v.y;
1417
1417
 
1418
1418
  Vector2 rotatedVector;
1419
- rotatedVector.x = (cos * tx) - (sin * ty);
1420
- rotatedVector.y = (sin * tx) + (cos * ty);
1419
+ rotatedVector.x = cos * tx - sin * ty;
1420
+ rotatedVector.y = sin * tx + cos * ty;
1421
1421
 
1422
1422
  return rotatedVector;
1423
1423
  }
@@ -1564,12 +1564,12 @@
1564
1564
 
1565
1565
  public static bool IsOnEdge2D(this FastVector3Int position, BoundsInt bounds)
1566
1566
  {
1567
- if (bounds.xMin == position.x || (bounds.xMax - 1) == position.x)
1567
+ if (bounds.xMin == position.x || bounds.xMax - 1 == position.x)
1568
1568
  {
1569
1569
  return bounds.yMin <= position.y && position.y < bounds.yMax;
1570
1570
  }
1571
1571
 
1572
- if (bounds.yMin == position.y || (bounds.yMax - 1) == position.y)
1572
+ if (bounds.yMin == position.y || bounds.yMax - 1 == position.y)
1573
1573
  {
1574
1574
  return bounds.xMin <= position.x && position.x < bounds.xMax;
1575
1575
  }
@@ -47,9 +47,9 @@
47
47
  }
48
48
 
49
49
  float a =
50
- (targetVelocity.x * targetVelocity.x)
51
- + (targetVelocity.y * targetVelocity.y)
52
- - (projectileSpeed * projectileSpeed);
50
+ targetVelocity.x * targetVelocity.x
51
+ + targetVelocity.y * targetVelocity.y
52
+ - projectileSpeed * projectileSpeed;
53
53
 
54
54
  float b =
55
55
  2
@@ -59,10 +59,10 @@
59
59
  );
60
60
 
61
61
  float c =
62
- ((target.x - launchLocation.x) * (target.x - launchLocation.x))
63
- + ((target.y - launchLocation.y) * (target.y - launchLocation.y));
62
+ (target.x - launchLocation.x) * (target.x - launchLocation.x)
63
+ + (target.y - launchLocation.y) * (target.y - launchLocation.y);
64
64
 
65
- float disc = b * b - (4 * a * c);
65
+ float disc = b * b - 4 * a * c;
66
66
  if (disc < 0)
67
67
  {
68
68
  return target;
@@ -72,8 +72,8 @@
72
72
  float t2 = (-1 * b - Mathf.Sqrt(disc)) / (2 * a);
73
73
  float t = Mathf.Max(t1, t2); // let us take the larger time value
74
74
 
75
- float aimX = target.x + (targetVelocity.x * t);
76
- float aimY = target.y + (targetVelocity.y * t);
75
+ float aimX = target.x + targetVelocity.x * t;
76
+ float aimY = target.y + targetVelocity.y * t;
77
77
 
78
78
  if (float.IsNaN(aimX) || float.IsNaN(aimY))
79
79
  {
@@ -283,7 +283,7 @@
283
283
  // optional delay execution from happening on 0, 1, 2, ... n-1 to 1, 2, ... n
284
284
  if (
285
285
  totalExecuted < totalCount
286
- && ((totalExecuted + (delay ? 1f : 0f)) / totalCount) <= percent
286
+ && (totalExecuted + (delay ? 1f : 0f)) / totalCount <= percent
287
287
  )
288
288
  {
289
289
  action();
@@ -137,11 +137,9 @@
137
137
  const string sizeCheck = "size=";
138
138
  AddDecoration(
139
139
  format =>
140
- (
141
- format.StartsWith(sizeCheck, StringComparison.OrdinalIgnoreCase)
142
- && int.TryParse(format.Substring(sizeCheck.Length), out _)
143
- || int.TryParse(format, out _)
144
- ),
140
+ format.StartsWith(sizeCheck, StringComparison.OrdinalIgnoreCase)
141
+ && int.TryParse(format.Substring(sizeCheck.Length), out _)
142
+ || int.TryParse(format, out _),
145
143
  format: (format, value) =>
146
144
  {
147
145
  if (!int.TryParse(format, out int size))
@@ -373,11 +371,26 @@
373
371
  )
374
372
  {
375
373
  bool stopLooping = false;
376
- foreach (var entry in _matchingDecorations)
374
+ foreach (
375
+ KeyValuePair<
376
+ int,
377
+ List<(
378
+ string tag,
379
+ bool editorOnly,
380
+ Func<string, bool> predicate,
381
+ Func<string, object, string> formatter
382
+ )>
383
+ > entry in _matchingDecorations
384
+ )
377
385
  {
378
386
  for (int i = 0; i < entry.Value.Count; i++)
379
387
  {
380
- var existingDecoration = entry.Value[i];
388
+ (
389
+ string tag,
390
+ bool editorOnly,
391
+ Func<string, bool> predicate,
392
+ Func<string, object, string> formatter
393
+ ) existingDecoration = entry.Value[i];
381
394
  if (
382
395
  !string.Equals(
383
396
  existingDecoration.tag,
@@ -459,7 +472,17 @@
459
472
  ) decoration
460
473
  )
461
474
  {
462
- foreach (var entry in _matchingDecorations)
475
+ foreach (
476
+ KeyValuePair<
477
+ int,
478
+ List<(
479
+ string tag,
480
+ bool editorOnly,
481
+ Func<string, bool> predicate,
482
+ Func<string, object, string> formatter
483
+ )>
484
+ > entry in _matchingDecorations
485
+ )
463
486
  {
464
487
  for (int i = 0; i < entry.Value.Count; ++i)
465
488
  {
@@ -156,7 +156,7 @@
156
156
  }
157
157
  }
158
158
 
159
- Transform transform = (component as Transform) ?? component.transform;
159
+ Transform transform = component as Transform ?? component.transform;
160
160
  if (transform == null)
161
161
  {
162
162
  return;
@@ -187,7 +187,7 @@
187
187
  behavior.enabled = enabled;
188
188
  }
189
189
 
190
- Transform transform = (component as Transform) ?? component.transform;
190
+ Transform transform = component as Transform ?? component.transform;
191
191
  if (transform == null)
192
192
  {
193
193
  return;
@@ -11,7 +11,7 @@
11
11
  public static DotNetRandom Instance => ThreadLocalRandom<DotNetRandom>.Instance;
12
12
 
13
13
  public override RandomState InternalState =>
14
- new RandomState(unchecked((ulong)_seed), state2: _numberGenerated);
14
+ new(unchecked((ulong)_seed), state2: _numberGenerated);
15
15
 
16
16
  private ulong _numberGenerated;
17
17
  private int _seed;
@@ -45,7 +45,7 @@
45
45
  ulong z = _state;
46
46
  z = (z ^ (z >> 30)) * 0xBF58476D1CE4E5B9UL;
47
47
  z = (z ^ (z >> 27)) * 0x94D049BB133111EBUL;
48
- z ^= (z >> 31);
48
+ z ^= z >> 31;
49
49
 
50
50
  return (uint)z;
51
51
  }