public static bool HasPermission(int cell, int minion, int fromCell) { DebugUtil.Assert(HasAccessDoor[cell]); Restriction restriction = restrictions[cell]; Vector2I vector2I = CellToXY(cell); Vector2I vector2I2 = CellToXY(fromCell); Restriction.Directions directions = (Restriction.Directions) 0; switch (restriction.orientation) { case Restriction.Orientation.Vertical: { int num2 = vector2I.x - vector2I2.x; if (num2 < 0) { directions |= Restriction.Directions.Left; } if (num2 > 0) { directions |= Restriction.Directions.Right; } break; } case Restriction.Orientation.Horizontal: { int num = vector2I.y - vector2I2.y; if (num > 0) { directions |= Restriction.Directions.Left; } if (num < 0) { directions |= Restriction.Directions.Right; } break; } } Restriction.Directions value = (Restriction.Directions) 0; if (restriction.directionMasks.TryGetValue(minion, out value) || restriction.directionMasks.TryGetValue(-1, out value)) { return((value & directions) == (Restriction.Directions) 0); } return(true); }
public static void SetRestriction(int cell, int minion, Restriction.Directions directions) { Restriction restriction = restrictions[cell]; restriction.directionMasks[minion] = directions; }