public static void UpdateIcon(Door door)
 {
     try
     {
         ExtendedDoorState state = GetExtendedDoorState(door);
         SetIcon(door, state);
     }
     catch (Exception e)
     {
         State.Common.Logger.LogOnce("Update icon failed", e);
     }
 }
        private static void SetIcon(Door door, ExtendedDoorState targetState)
        {
            if (State.DoorIcons.TryGetValue(door, out var go))
            {
                var renderer = go.GetComponent <SpriteRenderer>();

                if (renderer != null)
                {
                    if (State.DoorSprites.TryGetValue(targetState, out var newSprite))
                    {
                        renderer.sprite  = newSprite;
                        renderer.enabled = newSprite != null;
                    }
                    else
                    {
                        renderer.enabled = false;
                    }
                }
            }
        }
        private static bool HasCustomGlobalPermissions(AccessControl access, out ExtendedDoorState doorState)
        {
            switch (access.DefaultPermission)
            {
            case AccessControl.Permission.GoLeft:
                doorState = ExtendedDoorState.AccessLeft;
                return(true);

            case AccessControl.Permission.GoRight:
                doorState = ExtendedDoorState.AccessRight;
                return(true);

            case AccessControl.Permission.Neither:
                doorState = ExtendedDoorState.AccessRestricted;
                return(true);

            default:
                doorState = ExtendedDoorState.Invalid;
                return(false);
            }
        }