-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBoundsExtension.cs
35 lines (28 loc) · 911 Bytes
/
BoundsExtension.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using UnityEngine;
namespace Aya.Extension
{
public static partial class BoundsExtension
{
#region Deconstruct
public static void Deconstruct(this Bounds bounds, out Vector3 center, out Vector3 size)
{
center = bounds.center;
size = bounds.size;
}
public static void Deconstruct(this Bounds bounds, out Vector3 center, out Vector3 size, out Vector3 min, out Vector3 max)
{
center = bounds.center;
size = bounds.size;
min = bounds.min;
max = bounds.max;
}
#endregion
#region With
public static Bounds With(this Bounds bounds, in Vector3? center = null, in Vector3? size = null)
{
var result = new Bounds(center ?? bounds.center, size ?? bounds.size);
return result;
}
#endregion
}
}