namespace VOID.Generic
{
    public static class LayerManager
    {
        public const int DefaultIndex = 0;
        public const int TransparentFXIndex = 1;
        public const int IgnoreRaycastIndex = 2;
        public const int WaterIndex = 4;
        public const int UIIndex = 5;
        public const int StaticIndex = 6;
        public const int DynamicIndex = 7;
        public const int TriggerIndex = 8;
        public const int CameraIndex = 9;
        public const int StaticHideableIndex = 10;
        public const int NavModifierIndex = 15;
        
        public const int Default = 1 << DefaultIndex;
        public const int TransparentFX = 1 << TransparentFXIndex;
        public const int IgnoreRaycast = 1 << IgnoreRaycastIndex;
        public const int Water = 1 << WaterIndex;
        public const int UI = 1 << UIIndex;
        public const int Static = 1 << StaticIndex;
        public const int Dynamic = 1 << DynamicIndex;
        public const int Trigger = 1 << TriggerIndex;
        public const int Camera = 1 << CameraIndex;
        public const int StaticHideable = 1 << StaticHideableIndex;
        public const int NavModifier = 1 << NavModifierIndex;

        public static int CodeToMask(int layerCode) => 1 << layerCode;
        public static bool MaskInMask(int layerMask1, int layerMask2) => (layerMask1 & layerMask2) > 0;
        public static bool CodeInMask(int layerCode1, int layerMask2) => MaskInMask(CodeToMask(layerCode1), layerMask2);
    }
}

