namespace Zinnia.Data.Type
{
using System;
using UnityEngine;
using Zinnia.Extension;
///
/// Allows a boolean to be set per element to provide a state reference.
///
[Serializable]
public struct Vector3State
{
///
/// The X State of the .
///
[Tooltip("The X State of the Vector3")]
public bool xState;
///
/// The Y State of the .
///
[Tooltip("The Y State of the Vector3")]
public bool yState;
///
/// The Z State of the .
///
[Tooltip("The Z State of the Vector3")]
public bool zState;
///
/// Shorthand for writing Vector3State(false, false, false).
///
public static readonly Vector3State False = new Vector3State(false, false, false);
///
/// Shorthand for writing Vector3State(true, true, true).
///
public static readonly Vector3State True = new Vector3State(true, true, true);
///
/// Shorthand for writing Vector3State(true, false, false).
///
public static readonly Vector3State XOnly = new Vector3State(true, false, false);
///
/// Shorthand for writing Vector3State(false, true, false).
///
public static readonly Vector3State YOnly = new Vector3State(false, true, false);
///
/// Shorthand for writing Vector3State(false, false, true).
///
public static readonly Vector3State ZOnly = new Vector3State(false, false, true);
///
/// Shorthand for writing Vector3State(true, true, false).
///
public static readonly Vector3State XYOnly = new Vector3State(true, true, false);
///
/// Shorthand for writing Vector3State(true, false, true).
///
public static readonly Vector3State XZOnly = new Vector3State(true, false, true);
///
/// Shorthand for writing Vector3State(false, true, true).
///
public static readonly Vector3State YZOnly = new Vector3State(false, true, true);
///
/// The Constructor that allows setting the individual states at instantiation.
///
/// The X State.
/// The Y State.
/// The Z State.
public Vector3State(bool x, bool y, bool z)
{
xState = x;
yState = y;
zState = z;
}
///
/// Returns the current state as a representation.
///
/// The representation of the current state.
public Vector3 ToVector3()
{
return new Vector3(xState ? 1f : 0f, yState ? 1f : 0f, zState ? 1f : 0f);
}
///
public override string ToString()
{
string[] titles = new string[]
{
"xState",
"yState",
"zState"
};
object[] values = new object[]
{
xState,
yState,
zState
};
return StringExtensions.FormatForToString(titles, values);
}
}
}