namespace VOID.Generic
{
    public static class NavAreaManager
    {
        public const int WalkableCode = 0;
        public const int NotWalkableCode = 1;
        public const int JumpCode = 2;
        public const int HardWalkableCode = 3;
        public const int DangerousWalkableCode = 4;
        public const int DoorCode = 5;
        
        public const int Walkable = 1 << WalkableCode;
        public const int NotWalkable = 1 << NotWalkableCode;
        public const int Jump = 1 << JumpCode;
        public const int HardWalkable = 1 << HardWalkableCode;
        public const int DangerousWalkable = 1 << DangerousWalkableCode;
        public const int Door = 1 << DoorCode;

        public const int AllExceptWalkable = ~WalkableCode;
        public const int AllExceptNotWalkable = ~NotWalkableCode;
        public const int AllExceptJump = ~JumpCode;
        public const int AllExceptHardWalkable = ~HardWalkableCode;
        public const int AllExceptDangerousWalkable = ~DangerousWalkableCode;
        public const int AllExceptDoor = ~DoorCode;

        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);
    }
}

