/// <summary> /// Sets the value of the Y axe. /// </summary> public Vector3 SetY(float y) { if (y != Value.y) { Value.y = y; UpdatedAxes |= Vector3Axe.Y; } return(Value); }
/// <summary> /// Sets the value of the X axe. /// </summary> public Vector3 SetX(float x) { if (x != Value.x) { Value.x = x; UpdatedAxes |= Vector3Axe.X; } return Value; }
/// <summary> /// Sets the value of the Z axe. /// </summary> public Vector3 SetZ(float z) { if (z != Value.z) { Value.z = z; UpdatedAxes |= Vector3Axe.Z; } return(Value); }
/// <summary> /// Sets the value of the X axe. /// </summary> public Vector3 SetX(float x) { if (x != Value.x) { Value.x = x; UpdatedAxes |= Vector3Axe.X; } return(Value); }
/// <summary> /// Helper function that draws a field of 3 floats. /// </summary> static Vector3Update DrawVector3(Vector3 value, Vector3Axe multipleValueAxes) { GUILayoutOption opt = GUILayout.MinWidth(30f); Vector3Update update = new Vector3Update() { Value = value }; update.SetX(DrawFloatField("X", value.x, ((multipleValueAxes & Vector3Axe.X) == Vector3Axe.None), opt)); update.SetY(DrawFloatField("Y", value.y, ((multipleValueAxes & Vector3Axe.Y) == Vector3Axe.None), opt)); update.SetZ(DrawFloatField("Z", value.z, ((multipleValueAxes & Vector3Axe.Z) == Vector3Axe.None), opt)); return(update); }
/// <summary> /// Gets the axes of a Vector3 which have multiple values. /// </summary> Vector3Axe GetMultipleValuesAxes(SerializedProperty property) { Vector3Axe axes = Vector3Axe.None; if (!property.hasMultipleDifferentValues) { return(Vector3Axe.None); } // We know that we have at least one serialized object when this is called. Vector3 current = GetVector(property, serializedObject.targetObjects[0] as Transform); Vector3 next; // We check that the value of the axe are all the same. foreach (Object obj in serializedObject.targetObjects) { next = GetVector(property, obj as Transform); if (next.x != current.x) { axes |= Vector3Axe.X; } if (next.y != current.y) { axes |= Vector3Axe.Y; } if (next.z != current.z) { axes |= Vector3Axe.Z; } if (axes == Vector3Axe.All) { return(axes); } } return(axes); }
/// <summary> /// Sets the value of the Z axe. /// </summary> public Vector3 SetZ(float z) { if (z != Value.z) { Value.z = z; UpdatedAxes |= Vector3Axe.Z; } return Value; }
/// <summary> /// Sets the value of the Y axe. /// </summary> public Vector3 SetY(float y) { if (y != Value.y) { Value.y = y; UpdatedAxes |= Vector3Axe.Y; } return Value; }
/// <summary> /// Force the update of the vector on all Axes using the given value. /// </summary> public Vector3 ForceSet(Vector3 newValue) { UpdatedAxes = Vector3Axe.All; Value = newValue; return Value; }
/// <summary> /// Helper function that draws a field of 3 floats. /// </summary> static Vector3Update DrawVector3(Vector3 value, Vector3Axe multipleValueAxes) { GUILayoutOption opt = GUILayout.MinWidth(30f); Vector3Update update = new Vector3Update() { Value = value }; update.SetX(DrawFloatField("X", value.x, ((multipleValueAxes & Vector3Axe.X) == Vector3Axe.None), opt)); update.SetY(DrawFloatField("Y", value.y, ((multipleValueAxes & Vector3Axe.Y) == Vector3Axe.None), opt)); update.SetZ(DrawFloatField("Z", value.z, ((multipleValueAxes & Vector3Axe.Z) == Vector3Axe.None), opt)); return update; }
/// <summary> /// Checks if an axe has been modified. /// </summary> public bool IsAxeUpdated(Vector3Axe axe) { return (UpdatedAxes & axe) == axe; }
/// <summary> /// Force the update of the vector on all Axes using the given value. /// </summary> public Vector3 ForceSet(Vector3 newValue) { UpdatedAxes = Vector3Axe.All; Value = newValue; return(Value); }
/// <summary> /// Checks if an axe has been modified. /// </summary> public bool IsAxeUpdated(Vector3Axe axe) { return((UpdatedAxes & axe) == axe); }