Skip to content

Commit

Permalink
feat(Data): add more shorthand states for Vector3State
Browse files Browse the repository at this point in the history
The Vector3State type now has additional short hand initialisers like
XYOnly, XZOnly and YZOnly.
  • Loading branch information
thestonefox committed May 1, 2023
1 parent 057201c commit 57ac8be
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Runtime/Data/Type/Vector3State.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,21 @@ public struct Vector3State
/// </summary>
public static readonly Vector3State ZOnly = new Vector3State(false, false, true);

/// <summary>
/// Shorthand for writing <c>Vector3State(true, true, false)</c>.
/// </summary>
public static readonly Vector3State XYOnly = new Vector3State(true, true, false);

/// <summary>
/// Shorthand for writing <c>Vector3State(true, false, true)</c>.
/// </summary>
public static readonly Vector3State XZOnly = new Vector3State(true, false, true);

/// <summary>
/// Shorthand for writing <c>Vector3State(false, true, true)</c>.
/// </summary>
public static readonly Vector3State YZOnly = new Vector3State(false, true, true);

/// <summary>
/// The Constructor that allows setting the individual states at instantiation.
/// </summary>
Expand Down
27 changes: 27 additions & 0 deletions Tests/Editor/Data/Type/Vector3StateTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,33 @@ public void DefaultStateZAxis()
Assert.IsTrue(actualResult.zState);
}

[Test]
public void DefaultStateXYAxis()
{
Vector3State actualResult = Vector3State.XYOnly;
Assert.IsTrue(actualResult.xState);
Assert.IsTrue(actualResult.yState);
Assert.IsFalse(actualResult.zState);
}

[Test]
public void DefaultStateXZAxis()
{
Vector3State actualResult = Vector3State.XZOnly;
Assert.IsTrue(actualResult.xState);
Assert.IsFalse(actualResult.yState);
Assert.IsTrue(actualResult.zState);
}

[Test]
public void DefaultStateYZAxis()
{
Vector3State actualResult = Vector3State.YZOnly;
Assert.IsFalse(actualResult.xState);
Assert.IsTrue(actualResult.yState);
Assert.IsTrue(actualResult.zState);
}

[Test]
public void CustomInitialState()
{
Expand Down

0 comments on commit 57ac8be

Please sign in to comment.