using System; using UnityEngine; using UnityEngine.TestTools; namespace BracerLib.Data { [Serializable, ExcludeFromCoverage] public struct Layer : IEquatable { public static implicit operator int(Layer layer) { return layer.layerIndex; } [SerializeField] private int layerIndex; public int LayerIndex { get => layerIndex; set { if (value > 0 && value < 32) layerIndex = value; } } public int Mask => 1 << layerIndex; public bool Equals(Layer other) => layerIndex == other.layerIndex; public override bool Equals(object obj) => obj is Layer other && Equals(other); public override int GetHashCode() => layerIndex; public static bool operator ==(Layer left, Layer right) => left.Equals(right); public static bool operator !=(Layer left, Layer right) => !left.Equals(right); } }